MediaStore.OpenAssetFileDescriptor Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Works exactly the same as
ContentResolver#openAssetFileDescriptor(Uri, String, CancellationSignal)
,
but only works for Uri
whose scheme is ContentResolver#SCHEME_CONTENT
and its authority is MediaStore#AUTHORITY
.
[Android.Runtime.Register("openAssetFileDescriptor", "(Landroid/content/ContentResolver;Landroid/net/Uri;Ljava/lang/String;Landroid/os/CancellationSignal;)Landroid/content/res/AssetFileDescriptor;", "", ApiSince=36)]
public static Android.Content.Res.AssetFileDescriptor? OpenAssetFileDescriptor(Android.Content.ContentResolver resolver, Android.Net.Uri uri, string mode, Android.OS.CancellationSignal? cancellationSignal);
[<Android.Runtime.Register("openAssetFileDescriptor", "(Landroid/content/ContentResolver;Landroid/net/Uri;Ljava/lang/String;Landroid/os/CancellationSignal;)Landroid/content/res/AssetFileDescriptor;", "", ApiSince=36)>]
static member OpenAssetFileDescriptor : Android.Content.ContentResolver * Android.Net.Uri * string * Android.OS.CancellationSignal -> Android.Content.Res.AssetFileDescriptor
Parameters
- resolver
- ContentResolver
The ContentResolver
used to connect with
MediaStore#AUTHORITY
. Typically this value is gotten from
Context#getContentResolver()
- uri
- Uri
The desired URI to open.
- mode
- String
The string representation of the file mode. Can be "r", "w", "wt", "wa", "rw" or "rwt". Please note the exact implementation of these may differ for each Provider implementation - for example, "w" may or may not truncate.
- cancellationSignal
- CancellationSignal
Returns
a new ParcelFileDescriptor pointing to the file or null
if the
provider recently crashed. You own this descriptor and are responsible for closing it
when done.
- Attributes
Remarks
Works exactly the same as ContentResolver#openAssetFileDescriptor(Uri, String, CancellationSignal)
, but only works for Uri
whose scheme is ContentResolver#SCHEME_CONTENT
and its authority is MediaStore#AUTHORITY
.
This API is preferred over ContentResolver#openAssetFileDescriptor(Uri, String, CancellationSignal)
when opening media Uri for ensuring system stability especially when opening URIs returned as a result of using MediaStore#ACTION_PICK_IMAGES
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.