FileDocCategorySizeDatePackage
DocumentsContractApi21.javaAPI DocAndroid 5.1 API3091Thu Mar 12 22:22:56 GMT 2015android.support.v4.provider

DocumentsContractApi21

public class DocumentsContractApi21 extends Object

Fields Summary
private static final String
TAG
Constructors Summary
Methods Summary
private static voidcloseQuietly(java.lang.AutoCloseable closeable)

        if (closeable != null) {
            try {
                closeable.close();
            } catch (RuntimeException rethrown) {
                throw rethrown;
            } catch (Exception ignored) {
            }
        }
    
public static android.net.UricreateDirectory(android.content.Context context, android.net.Uri self, java.lang.String displayName)

        return createFile(context, self, DocumentsContract.Document.MIME_TYPE_DIR, displayName);
    
public static android.net.UricreateFile(android.content.Context context, android.net.Uri self, java.lang.String mimeType, java.lang.String displayName)


            
              
        return DocumentsContract.createDocument(context.getContentResolver(), self, mimeType,
                displayName);
    
public static android.net.Uri[]listFiles(android.content.Context context, android.net.Uri self)

        final ContentResolver resolver = context.getContentResolver();
        final Uri childrenUri = DocumentsContract.buildChildDocumentsUriUsingTree(self,
                DocumentsContract.getDocumentId(self));
        final ArrayList<Uri> results = new ArrayList<Uri>();

        Cursor c = null;
        try {
            c = resolver.query(childrenUri, new String[] {
                    DocumentsContract.Document.COLUMN_DOCUMENT_ID }, null, null, null);
            while (c.moveToNext()) {
                final String documentId = c.getString(0);
                final Uri documentUri = DocumentsContract.buildDocumentUriUsingTree(self,
                        documentId);
                results.add(documentUri);
            }
        } catch (Exception e) {
            Log.w(TAG, "Failed query: " + e);
        } finally {
            closeQuietly(c);
        }

        return results.toArray(new Uri[results.size()]);
    
public static android.net.UriprepareTreeUri(android.net.Uri treeUri)

        return DocumentsContract.buildDocumentUriUsingTree(treeUri,
                DocumentsContract.getTreeDocumentId(treeUri));
    
public static android.net.UrirenameTo(android.content.Context context, android.net.Uri self, java.lang.String displayName)

        return DocumentsContract.renameDocument(context.getContentResolver(), self, displayName);