DocumentsContract.Document | API reference | Android Developers (original) (raw)
public static final class DocumentsContract.Documentextends [Object](/reference/java/lang/Object) ``
Constants related to a document, including [Cursor](/reference/android/database/Cursor) column names and flags.
A document can be either an openable stream (with a specific MIME type), or a directory containing additional documents (with the[MIME_TYPE_DIR](/reference/android/provider/DocumentsContract.Document#MIME%5FTYPE%5FDIR) MIME type). A directory represents the top of a subtree containing zero or more documents, which can recursively contain even more documents and directories.
All columns are read-only to client applications.
Summary
| Constants | |
|---|---|
| String | COLUMN_CONTENT_SYNC_STATE_FLAGS Column indicating the synchronization state of the document's contents represented as a bitmask, null if not provided. |
| String | COLUMN_DISPLAY_NAME Display name of a document, used as the primary title displayed to a user. |
| String | COLUMN_DOCUMENT_ID Unique ID of a document. |
| String | COLUMN_FLAGS Flags that apply to a document. |
| String | COLUMN_ICON Specific icon resource ID for a document. |
| String | COLUMN_LAST_MODIFIED Timestamp when a document was last modified, in milliseconds since January 1, 1970 00:00:00.0 UTC. |
| String | COLUMN_MIME_TYPE Concrete MIME type of a document. |
| String | COLUMN_ORIGINAL_RELATIVE_PATH The relative path of the original location of a trashed document. |
| String | COLUMN_SIZE Size of a document, in bytes, or null if unknown. |
| String | COLUMN_SUMMARY Summary of a document, which may be shown to a user. |
| int | FLAG_DIR_BLOCKS_OPEN_DOCUMENT_TREE Flag indicating that a document is a directory that wants to block itself from being selected when the user launches an Intent.ACTION_OPEN_DOCUMENT_TREE intent. |
| int | FLAG_DIR_PREFERS_GRID Flag indicating that a directory prefers its contents be shown in a larger format grid. |
| int | FLAG_DIR_PREFERS_LAST_MODIFIED Flag indicating that a directory prefers its contents be sorted byCOLUMN_LAST_MODIFIED. |
| int | FLAG_DIR_SUPPORTS_CREATE Flag indicating that a document is a directory that supports creation of new files within it. |
| int | FLAG_PARTIAL Flag indicating that a document is not complete, likely its contents are being downloaded. |
| int | FLAG_SUPPORTS_COPY Flag indicating that a document can be copied to another location within the same document provider. |
| int | FLAG_SUPPORTS_DELETE Flag indicating that a document is deletable. |
| int | FLAG_SUPPORTS_METADATA Flag indicating that a document has available metadata that can be read using DocumentsContract#getDocumentMetadata |
| int | FLAG_SUPPORTS_MOVE Flag indicating that a document can be moved to another location within the same document provider. |
| int | FLAG_SUPPORTS_REMOVE Flag indicating that a document can be removed from a parent. |
| int | FLAG_SUPPORTS_RENAME Flag indicating that a document can be renamed. |
| int | FLAG_SUPPORTS_RESTORE Flag indicating that a document can be restored. |
| int | FLAG_SUPPORTS_SETTINGS Flag indicating that a document has settings that can be configured by user. |
| int | FLAG_SUPPORTS_THUMBNAIL Flag indicating that a document can be represented as a thumbnail. |
| int | FLAG_SUPPORTS_TRASH Flag indicating that a document can be trashed. |
| int | FLAG_SUPPORTS_WRITE Flag indicating that a document supports writing. |
| int | FLAG_VIRTUAL_DOCUMENT Flag indicating that a document is virtual, and doesn't have byte representation in the MIME type specified as COLUMN_MIME_TYPE. |
| int | FLAG_WEB_LINKABLE Flag indicating that a Web link can be obtained for the document. |
| String | MIME_TYPE_DIR MIME type of a document which is a directory that may contain additional documents. |
| int | SYNC_STATE_FLAG_AVAILABLE_LOCALLY Flag indicating that the document's contents are available locally. |
| int | SYNC_STATE_FLAG_DOWNLOAD_ERROR Flag indicating that the last download attempt resulted in an error. |
| int | SYNC_STATE_FLAG_DOWNLOAD_PROGRESS Flag indicating that a download of remote changes is currently in progress. |
| int | SYNC_STATE_FLAG_LOCAL_CHANGES Flag indicating that the local version of the document has changes that require an upload. |
| int | SYNC_STATE_FLAG_UPLOAD_ERROR Flag indicating that the last upload attempt resulted in an error. |
| int | SYNC_STATE_FLAG_UPLOAD_PROGRESS Flag indicating that an upload of local changes is currently in progress. |
| Inherited methods |
|---|
| From class java.lang.Object Object clone() Creates and returns a copy of this object. boolean equals(Object obj) Indicates whether some other object is "equal to" this one. void finalize() Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. finalClass<?> getClass() Returns the runtime class of this Object. int hashCode() Returns a hash code value for the object. final void notify() Wakes up a single thread that is waiting on this object's monitor. final void notifyAll() Wakes up all threads that are waiting on this object's monitor. String toString() Returns a string representation of the object. final void wait(long timeoutMillis, int nanos) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed. final void wait(long timeoutMillis) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed. final void wait() Causes the current thread to wait until it is awakened, typically by being notified or interrupted. |
Constants
COLUMN_DISPLAY_NAME
public static final String COLUMN_DISPLAY_NAME
Display name of a document, used as the primary title displayed to a user. This column is required.
Type: STRING
Constant Value: "_display_name"
COLUMN_DOCUMENT_ID
public static final String COLUMN_DOCUMENT_ID
Unique ID of a document. This ID is both provided by and interpreted by a [DocumentsProvider](/reference/android/provider/DocumentsProvider), and should be treated as an opaque value by client applications. This column is required.
Each document must have a unique ID within a provider, but that single document may be included as a child of multiple directories.
A provider must always return durable IDs, since they will be used to issue long-term URI permission grants when an application interacts with [Intent.ACTION_OPEN_DOCUMENT](/reference/android/content/Intent#ACTION%5FOPEN%5FDOCUMENT) and[Intent.ACTION_CREATE_DOCUMENT](/reference/android/content/Intent#ACTION%5FCREATE%5FDOCUMENT).
Type: STRING
Constant Value: "document_id"
COLUMN_ICON
public static final String COLUMN_ICON
Specific icon resource ID for a document. This column is optional, and may be null to use a platform-provided default icon based on [COLUMN_MIME_TYPE](/reference/android/provider/DocumentsContract.Document#COLUMN%5FMIME%5FTYPE).
Type: INTEGER (int)
Constant Value: "icon"
COLUMN_LAST_MODIFIED
public static final String COLUMN_LAST_MODIFIED
Timestamp when a document was last modified, in milliseconds since January 1, 1970 00:00:00.0 UTC. This column is required, and may benull if unknown. A [DocumentsProvider](/reference/android/provider/DocumentsProvider) can update this field using events from [OnCloseListener](/reference/android/os/ParcelFileDescriptor.OnCloseListener) or other reliable[ParcelFileDescriptor](/reference/android/os/ParcelFileDescriptor) transports.
Type: INTEGER (long)
Constant Value: "last_modified"
COLUMN_MIME_TYPE
public static final String COLUMN_MIME_TYPE
Concrete MIME type of a document. For example, "image/png" or "application/pdf" for openable files. A document can also be a directory containing additional documents, which is represented with the [MIME_TYPE_DIR](/reference/android/provider/DocumentsContract.Document#MIME%5FTYPE%5FDIR) MIME type. This column is required.
Type: STRING
Constant Value: "mime_type"
COLUMN_ORIGINAL_RELATIVE_PATH
public static final String COLUMN_ORIGINAL_RELATIVE_PATH
The relative path of the original location of a trashed document. This column is only valid for trashed documents.
Type: STRING
Constant Value: "original_relative_path"
COLUMN_SIZE
public static final String COLUMN_SIZE
Size of a document, in bytes, or null if unknown. This column is required.
Type: INTEGER (long)
Constant Value: "_size"
COLUMN_SUMMARY
public static final String COLUMN_SUMMARY
Summary of a document, which may be shown to a user. This column is optional, and may be null.
Type: STRING
Constant Value: "summary"
FLAG_DIR_BLOCKS_OPEN_DOCUMENT_TREE
public static final int FLAG_DIR_BLOCKS_OPEN_DOCUMENT_TREE
Flag indicating that a document is a directory that wants to block itself from being selected when the user launches an [Intent.ACTION_OPEN_DOCUMENT_TREE](/reference/android/content/Intent#ACTION%5FOPEN%5FDOCUMENT%5FTREE) intent. Individual files can still be selected when launched via other intents like [Intent.ACTION_OPEN_DOCUMENT](/reference/android/content/Intent#ACTION%5FOPEN%5FDOCUMENT) and [Intent.ACTION_GET_CONTENT](/reference/android/content/Intent#ACTION%5FGET%5FCONTENT). Only valid when [COLUMN_MIME_TYPE](/reference/android/provider/DocumentsContract.Document#COLUMN%5FMIME%5FTYPE) is [MIME_TYPE_DIR](/reference/android/provider/DocumentsContract.Document#MIME%5FTYPE%5FDIR).
Note that this flag only applies to the single directory to which it is applied. It does not block the user from selecting either a parent or child directory during an [Intent.ACTION_OPEN_DOCUMENT_TREE](/reference/android/content/Intent#ACTION%5FOPEN%5FDOCUMENT%5FTREE) request. In particular, the only way to guarantee that a specific directory can never be granted via an [Intent.ACTION_OPEN_DOCUMENT_TREE](/reference/android/content/Intent#ACTION%5FOPEN%5FDOCUMENT%5FTREE) request is to ensure that both it and all of its parent directories have set this flag.
Constant Value: 32768 (0x00008000)
FLAG_DIR_PREFERS_GRID
public static final int FLAG_DIR_PREFERS_GRID
Flag indicating that a directory prefers its contents be shown in a larger format grid. Usually suitable when a directory contains mostly pictures. Only valid when [COLUMN_MIME_TYPE](/reference/android/provider/DocumentsContract.Document#COLUMN%5FMIME%5FTYPE) is[MIME_TYPE_DIR](/reference/android/provider/DocumentsContract.Document#MIME%5FTYPE%5FDIR).
Constant Value: 16 (0x00000010)
FLAG_DIR_PREFERS_LAST_MODIFIED
public static final int FLAG_DIR_PREFERS_LAST_MODIFIED
Flag indicating that a directory prefers its contents be sorted by[COLUMN_LAST_MODIFIED](/reference/android/provider/DocumentsContract.Document#COLUMN%5FLAST%5FMODIFIED). Only valid when[COLUMN_MIME_TYPE](/reference/android/provider/DocumentsContract.Document#COLUMN%5FMIME%5FTYPE) is [MIME_TYPE_DIR](/reference/android/provider/DocumentsContract.Document#MIME%5FTYPE%5FDIR).
Constant Value: 32 (0x00000020)
FLAG_DIR_SUPPORTS_CREATE
public static final int FLAG_DIR_SUPPORTS_CREATE
Flag indicating that a document is a directory that supports creation of new files within it. Only valid when [COLUMN_MIME_TYPE](/reference/android/provider/DocumentsContract.Document#COLUMN%5FMIME%5FTYPE) is[MIME_TYPE_DIR](/reference/android/provider/DocumentsContract.Document#MIME%5FTYPE%5FDIR).
Constant Value: 8 (0x00000008)
FLAG_PARTIAL
public static final int FLAG_PARTIAL
Flag indicating that a document is not complete, likely its contents are being downloaded. Partial files cannot be opened, copied, moved in the UI. But they can be deleted and retried if they represent a failed download.
Constant Value: 8192 (0x00002000)
FLAG_SUPPORTS_METADATA
public static final int FLAG_SUPPORTS_METADATA
Flag indicating that a document has available metadata that can be read using DocumentsContract#getDocumentMetadata
Constant Value: 16384 (0x00004000)
FLAG_SUPPORTS_SETTINGS
public static final int FLAG_SUPPORTS_SETTINGS
Flag indicating that a document has settings that can be configured by user.
Constant Value: 2048 (0x00000800)
FLAG_WEB_LINKABLE
public static final int FLAG_WEB_LINKABLE
Flag indicating that a Web link can be obtained for the document.
Constant Value: 4096 (0x00001000)
MIME_TYPE_DIR
public static final String MIME_TYPE_DIR
MIME type of a document which is a directory that may contain additional documents.
Constant Value: "vnd.android.document/directory"
SYNC_STATE_FLAG_AVAILABLE_LOCALLY
public static final int SYNC_STATE_FLAG_AVAILABLE_LOCALLY
Flag indicating that the document's contents are available locally. When the device does not have internet connection, certain document operations may be disabled, see[Root.FLAG_LIMITED_FUNCTIONALITY_WHEN_OFFLINE](/reference/android/provider/DocumentsContract.Root#FLAG%5FLIMITED%5FFUNCTIONALITY%5FWHEN%5FOFFLINE) for more details.
Constant Value: 1 (0x00000001)
SYNC_STATE_FLAG_DOWNLOAD_ERROR
public static final int SYNC_STATE_FLAG_DOWNLOAD_ERROR
Flag indicating that the last download attempt resulted in an error.
Constant Value: 32 (0x00000020)
SYNC_STATE_FLAG_DOWNLOAD_PROGRESS
public static final int SYNC_STATE_FLAG_DOWNLOAD_PROGRESS
Flag indicating that a download of remote changes is currently in progress.
Constant Value: 8 (0x00000008)
SYNC_STATE_FLAG_LOCAL_CHANGES
public static final int SYNC_STATE_FLAG_LOCAL_CHANGES
Flag indicating that the local version of the document has changes that require an upload. This flag is only meaningful if [SYNC_STATE_FLAG_AVAILABLE_LOCALLY](/reference/android/provider/DocumentsContract.Document#SYNC%5FSTATE%5FFLAG%5FAVAILABLE%5FLOCALLY) is also set.
Constant Value: 2 (0x00000002)