Document
class Document
| kotlin.Any | |
| ↳ | 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 | |
|---|---|
| static String |
Display name of a document, used as the primary title displayed to a user. |
| static String |
Unique ID of a document. |
| static String |
Flags that apply to a document. |
| static String |
Specific icon resource ID for a document. |
| static String |
Timestamp when a document was last modified, in milliseconds since January 1, 1970 00:00:00. |
| static String |
Concrete MIME type of a document. |
| static String |
Size of a document, in bytes, or |
| static String |
Summary of a document, which may be shown to a user. |
| static Int |
Flag indicating that a document is a directory that wants to block itself from being selected when the user launches an |
| static Int |
Flag indicating that a directory prefers its contents be shown in a larger format grid. |
| static Int |
Flag indicating that a directory prefers its contents be sorted by |
| static Int |
Flag indicating that a document is a directory that supports creation of new files within it. |
| static Int |
Flag indicating that a document is not complete, likely its contents are being downloaded. |
| static Int |
Flag indicating that a document can be copied to another location within the same document provider. |
| static Int |
Flag indicating that a document is deletable. |
| static Int |
Flag indicating that a document has available metadata that can be read using DocumentsContract#getDocumentMetadata |
| static Int |
Flag indicating that a document can be moved to another location within the same document provider. |
| static Int |
Flag indicating that a document can be removed from a parent. |
| static Int |
Flag indicating that a document can be renamed. |
| static Int |
Flag indicating that a document has settings that can be configured by user. |
| static Int |
Flag indicating that a document can be represented as a thumbnail. |
| static Int |
Flag indicating that a document supports writing. |
| static Int |
Flag indicating that a document is virtual, and doesn't have byte representation in the MIME type specified as |
| static Int |
Flag indicating that a Web link can be obtained for the document. |
| static String |
MIME type of a document which is a directory that may contain additional documents. |
Constants
COLUMN_DISPLAY_NAME
static val COLUMN_DISPLAY_NAME: String
Display name of a document, used as the primary title displayed to a user. This column is required.
Type: STRING
Value: "_display_name"COLUMN_DOCUMENT_ID
static val COLUMN_DOCUMENT_ID: String
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 Intent.ACTION_OPEN_DOCUMENT and Intent.ACTION_CREATE_DOCUMENT.
Type: STRING
Value: "document_id"COLUMN_FLAGS
static val COLUMN_FLAGS: String
Flags that apply to a document. This column is required.
Type: INTEGER (int)
Value: "flags"See Also
#FLAG_DIR_BLOCKS_OPEN_DOCUMENT_TREE#FLAG_DIR_PREFERS_GRID#FLAG_DIR_PREFERS_LAST_MODIFIED#FLAG_DIR_SUPPORTS_CREATE#FLAG_PARTIAL#FLAG_SUPPORTS_COPY#FLAG_SUPPORTS_DELETE#FLAG_SUPPORTS_METADATA#FLAG_SUPPORTS_MOVE#FLAG_SUPPORTS_REMOVE#FLAG_SUPPORTS_RENAME#FLAG_SUPPORTS_SETTINGS#FLAG_SUPPORTS_THUMBNAIL#FLAG_SUPPORTS_WRITE#FLAG_VIRTUAL_DOCUMENT#FLAG_WEB_LINKABLE
COLUMN_ICON
static val COLUMN_ICON: String
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)
Value: "icon"COLUMN_LAST_MODIFIED
static val COLUMN_LAST_MODIFIED: String
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 OnCloseListener or other reliable ParcelFileDescriptor transports.
Type: INTEGER (long)
Value: "last_modified"See Also
COLUMN_MIME_TYPE
static val COLUMN_MIME_TYPE: String
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
Value: "mime_type"See Also
COLUMN_SIZE
static val COLUMN_SIZE: String
Size of a document, in bytes, or null if unknown. This column is required.
Type: INTEGER (long)
Value: "_size"COLUMN_SUMMARY
static val COLUMN_SUMMARY: String
Summary of a document, which may be shown to a user. This column is optional, and may be null.
Type: STRING
Value: "summary"FLAG_DIR_BLOCKS_OPEN_DOCUMENT_TREE
static val FLAG_DIR_BLOCKS_OPEN_DOCUMENT_TREE: Int
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. Individual files can still be selected when launched via other intents like Intent.ACTION_OPEN_DOCUMENT and Intent.ACTION_GET_CONTENT. Only valid when COLUMN_MIME_TYPE is MIME_TYPE_DIR.
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 request. In particular, the only way to guarantee that a specific directory can never be granted via an Intent.ACTION_OPEN_DOCUMENT_TREE request is to ensure that both it and all of its parent directories have set this flag.
Value: 32768FLAG_DIR_PREFERS_GRID
static val FLAG_DIR_PREFERS_GRID: Int
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.
Value: 16See Also
FLAG_DIR_PREFERS_LAST_MODIFIED
static val FLAG_DIR_PREFERS_LAST_MODIFIED: Int
Flag indicating that a directory prefers its contents be sorted by COLUMN_LAST_MODIFIED. Only valid when COLUMN_MIME_TYPE is MIME_TYPE_DIR.
Value: 32See Also
FLAG_DIR_SUPPORTS_CREATE
static val FLAG_DIR_SUPPORTS_CREATE: Int
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.
Value: 8FLAG_PARTIAL
static val FLAG_PARTIAL: Int
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.
Value: 8192See Also
FLAG_SUPPORTS_COPY
static val FLAG_SUPPORTS_COPY: Int
Flag indicating that a document can be copied to another location within the same document provider.
Value: 128FLAG_SUPPORTS_DELETE
static val FLAG_SUPPORTS_DELETE: Int
Flag indicating that a document is deletable.
Value: 4FLAG_SUPPORTS_METADATA
static val FLAG_SUPPORTS_METADATA: Int
Flag indicating that a document has available metadata that can be read using DocumentsContract#getDocumentMetadata
Value: 16384FLAG_SUPPORTS_MOVE
static val FLAG_SUPPORTS_MOVE: Int
Flag indicating that a document can be moved to another location within the same document provider.
Value: 256FLAG_SUPPORTS_REMOVE
static val FLAG_SUPPORTS_REMOVE: Int
Flag indicating that a document can be removed from a parent.
Value: 1024FLAG_SUPPORTS_RENAME
static val FLAG_SUPPORTS_RENAME: Int
Flag indicating that a document can be renamed.
Value: 64FLAG_SUPPORTS_SETTINGS
static val FLAG_SUPPORTS_SETTINGS: Int
Flag indicating that a document has settings that can be configured by user.
Value: 2048See Also
FLAG_SUPPORTS_THUMBNAIL
static val FLAG_SUPPORTS_THUMBNAIL: Int
Flag indicating that a document can be represented as a thumbnail.
Value: 1FLAG_SUPPORTS_WRITE
static val FLAG_SUPPORTS_WRITE: Int
Flag indicating that a document supports writing.
When a document is opened with Intent.ACTION_OPEN_DOCUMENT, the calling application is granted both Intent.FLAG_GRANT_READ_URI_PERMISSION and Intent.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 ContentResolver.openOutputStream(Uri) to succeed.
Value: 2See Also
FLAG_VIRTUAL_DOCUMENT
static val FLAG_VIRTUAL_DOCUMENT: Int
Flag indicating that a document is virtual, and doesn't have byte representation in the MIME type specified as COLUMN_MIME_TYPE.
Virtual documents must have at least one alternative streamable format via DocumentsProvider.openTypedDocument
Value: 512FLAG_WEB_LINKABLE
static val FLAG_WEB_LINKABLE: Int
Flag indicating that a Web link can be obtained for the document.
Value: 4096MIME_TYPE_DIR
static val MIME_TYPE_DIR: String
MIME type of a document which is a directory that may contain additional documents.
Value: "vnd.android.document/directory"See Also