Please note that the contents of this offline web site may be out of date. To access the most recent documentation visit the online version .
Note that links that point to online resources are green in color and will open in a new window.
We would love it if you could give us feedback about this material by filling this form (You have to be online to fill it)
Android APIs
public static final class

DocumentsContract.Document

extends Object
java.lang.Object
   ↳ android.provider.DocumentsContract.Document

Class Overview

Constants related to a document, including 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 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_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_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_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 by COLUMN_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_SUPPORTS_DELETE Flag indicating that a document is deletable.
int FLAG_SUPPORTS_THUMBNAIL Flag indicating that a document can be represented as a thumbnail.
int FLAG_SUPPORTS_WRITE Flag indicating that a document supports writing.
String MIME_TYPE_DIR MIME type of a document which is a directory that may contain additional documents.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

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"

public static final String COLUMN_DOCUMENT_ID

Unique ID of a document. This ID is both provided by and interpreted by a 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 ACTION_OPEN_DOCUMENT and ACTION_CREATE_DOCUMENT .

Type: STRING

Constant Value: "document_id"

public static final String COLUMN_FLAGS

Flags that apply to a document. This column is required.

Type: INTEGER (int)

Constant Value: "flags"

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 .

Type: INTEGER (int)

Constant Value: "icon"

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 be null if unknown. A DocumentsProvider can update this field using events from ParcelFileDescriptor.OnCloseListener or other reliable ParcelFileDescriptor transports.

Type: INTEGER (long)

Constant Value: "last_modified"

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 MIME type. This column is required.

Type: STRING

Constant Value: "mime_type"

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"

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"

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 is MIME_TYPE_DIR .

Constant Value: 16 (0x00000010)

public static final int FLAG_DIR_PREFERS_LAST_MODIFIED

Flag indicating that a directory prefers its contents be sorted by COLUMN_LAST_MODIFIED . Only valid when COLUMN_MIME_TYPE is MIME_TYPE_DIR .

Constant Value: 32 (0x00000020)

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 is MIME_TYPE_DIR .

Constant Value: 8 (0x00000008)

public static final int FLAG_SUPPORTS_DELETE

Flag indicating that a document is deletable.

Constant Value: 4 (0x00000004)

public static final int FLAG_SUPPORTS_THUMBNAIL

Flag indicating that a document can be represented as a thumbnail.

Constant Value: 1 (0x00000001)

public static final int FLAG_SUPPORTS_WRITE

Flag indicating that a document supports writing.

When a document is opened with ACTION_OPEN_DOCUMENT , the calling application is granted both FLAG_GRANT_READ_URI_PERMISSION and FLAG_GRANT_WRITE_URI_PERMISSION . However, the actual writability of a document may change over time, for example due to remote access changes. This flag indicates that a document client can expect openOutputStream(Uri) to succeed.

Constant Value: 2 (0x00000002)

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"