次の方法で共有


DocumentsProvider.OpenDocument(String, String, CancellationSignal) Method

Definition

Open and return the requested document.

[Android.Runtime.Register("openDocument", "(Ljava/lang/String;Ljava/lang/String;Landroid/os/CancellationSignal;)Landroid/os/ParcelFileDescriptor;", "GetOpenDocument_Ljava_lang_String_Ljava_lang_String_Landroid_os_CancellationSignal_Handler")]
public abstract Android.OS.ParcelFileDescriptor? OpenDocument (string? documentId, string? mode, Android.OS.CancellationSignal? signal);
[<Android.Runtime.Register("openDocument", "(Ljava/lang/String;Ljava/lang/String;Landroid/os/CancellationSignal;)Landroid/os/ParcelFileDescriptor;", "GetOpenDocument_Ljava_lang_String_Ljava_lang_String_Landroid_os_CancellationSignal_Handler")>]
abstract member OpenDocument : string * string * Android.OS.CancellationSignal -> Android.OS.ParcelFileDescriptor

Parameters

documentId
String

the document to return.

mode
String

the mode to open with, such as 'r', 'w', or 'rw'.

signal
CancellationSignal

used by the caller to signal if the request should be cancelled. May be null.

Returns

Attributes

Exceptions

Remarks

Open and return the requested document.

Your provider should return a reliable ParcelFileDescriptor to detect when the remote caller has finished reading or writing the document.

Mode "r" should always be supported. Provider should throw UnsupportedOperationException if the passing mode is not supported. You may return a pipe or socket pair if the mode is exclusively "r" or "w", but complex modes like "rw" imply a normal file on disk that supports seeking.

If you block while downloading content, you should periodically check CancellationSignal#isCanceled() to abort abandoned open requests.

Java documentation for android.provider.DocumentsProvider.openDocument(java.lang.String, java.lang.String, android.os.CancellationSignal).

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