共用方式為


Intent.ActionCreateDocument Field

Definition

Activity Action: Allow the user to create a new document.

[Android.Runtime.Register("ACTION_CREATE_DOCUMENT")]
public const string ActionCreateDocument;
[<Android.Runtime.Register("ACTION_CREATE_DOCUMENT")>]
val mutable ActionCreateDocument : string

Field Value

Implements

Attributes

Remarks

Activity Action: Allow the user to create a new document. When invoked, the system will display the various DocumentsProvider instances installed on the device, letting the user navigate through them. The returned document may be a newly created document with no content, or it may be an existing document with the requested MIME type.

Each document is represented as a content:// URI backed by a DocumentsProvider, which can be opened as a stream with ContentResolver#openFileDescriptor(Uri, String), or queried for android.provider.DocumentsContract.Document metadata.

Callers must indicate the concrete MIME type of the document being created by setting #setType(String). This MIME type cannot be changed after the document is created.

Callers can provide an initial display name through #EXTRA_TITLE, but the user may change this value before creating the file.

Callers must include #CATEGORY_OPENABLE in the Intent to obtain URIs that can be opened with ContentResolver#openFileDescriptor(Uri, String).

Callers can set a document URI through DocumentsContract#EXTRA_INITIAL_URI to indicate the initial location of documents navigator. System will do its best to launch the navigator in the specified document if it's a folder, or the folder that contains the specified document if not.

Output: The URI of the item that was created. This must be a content:// URI so that any receiver can access it.

Java documentation for android.content.Intent.ACTION_CREATE_DOCUMENT.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

See also