Skip to content

Most visited

Recently visited

navigation
Added in API level 19

DocumentsContract.Document

public static final class DocumentsContract.Document
extends Object

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


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_RENAME

Flag indicating that a document can be renamed.

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.

Inherited methods

From class java.lang.Object

Constants

COLUMN_DISPLAY_NAME

Added in API level 19
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

Added in API level 19
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"

COLUMN_FLAGS

Added in API level 19
String COLUMN_FLAGS

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

Type: INTEGER (int)

See also:

Constant Value: "flags"

COLUMN_ICON

Added in API level 19
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"

COLUMN_LAST_MODIFIED

Added in API level 19
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)

See also:

Constant Value: "last_modified"

COLUMN_MIME_TYPE

Added in API level 19
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

See also:

Constant Value: "mime_type"

COLUMN_SIZE

Added in API level 19
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

Added in API level 19
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_PREFERS_GRID

Added in API level 19
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.

See also:

Constant Value: 16 (0x00000010)

FLAG_DIR_PREFERS_LAST_MODIFIED

Added in API level 19
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.

See also:

Constant Value: 32 (0x00000020)

FLAG_DIR_SUPPORTS_CREATE

Added in API level 19
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.

See also:

Constant Value: 8 (0x00000008)

FLAG_SUPPORTS_DELETE

Added in API level 19
int FLAG_SUPPORTS_DELETE

Flag indicating that a document is deletable.

See also:

Constant Value: 4 (0x00000004)

FLAG_SUPPORTS_RENAME

Added in API level 21
int FLAG_SUPPORTS_RENAME

Flag indicating that a document can be renamed.

See also:

Constant Value: 64 (0x00000040)

FLAG_SUPPORTS_THUMBNAIL

Added in API level 19
int FLAG_SUPPORTS_THUMBNAIL

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

See also:

Constant Value: 1 (0x00000001)

FLAG_SUPPORTS_WRITE

Added in API level 19
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.

See also:

Constant Value: 2 (0x00000002)

MIME_TYPE_DIR

Added in API level 19
String MIME_TYPE_DIR

MIME type of a document which is a directory that may contain additional documents.

See also:

Constant Value: "vnd.android.document/directory"

This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.