Android.Content.ContentProvider.OpenTypedAssetFile Method
Called by a client to open a read-only stream containing data of a particular MIME type.

Syntax

[Android.Runtime.Register("openTypedAssetFile", "(Landroid/net/Uri;Ljava/lang/String;Landroid/os/Bundle;Landroid/os/CancellationSignal;)Landroid/content/res/AssetFileDescriptor;", "GetOpenTypedAssetFile_Landroid_net_Uri_Ljava_lang_String_Landroid_os_Bundle_Landroid_os_CancellationSignal_Handler")]
public virtual Android.Content.Res.AssetFileDescriptor OpenTypedAssetFile (Android.Net.Uri uri, string mimeTypeFilter, Android.OS.Bundle opts, Android.OS.CancellationSignal signal)

See Also

ContentProvider.GetStreamTypes(Android.Net.Uri, System.String)
ContentProvider.OpenAssetFile(Android.Net.Uri, System.String)
ClipDescription.CompareMimeTypes(string, System.String)

Parameters

uri
The data in the content provider being queried.
mimeTypeFilter
The type of data the client desires. May be a pattern, such as */*, if the caller does not have specific type requirements; in this case the content provider will pick its best type matching the pattern.
opts
Additional options from the client. The definitions of these are specific to the content provider being called.
signal
A signal to cancel the operation in progress, or null if none. For example, if you are downloading a file from the network to service a "rw" mode request, you should periodically call Android.OS.CancellationSignal.ThrowIfCanceled to check whether the client has canceled the request and abort the download.

Returns

Documentation for this section has not yet been entered.

Exceptions

TypeReason
Java.IO.FileNotFoundExceptionThrows FileNotFoundException if there is no file associated with the given URI or the mode is invalid.
Java.Lang.SecurityExceptionThrows SecurityException if the caller does not have permission to access the data.
Java.Lang.IllegalArgumentExceptionThrows IllegalArgumentException if the content provider does not support the requested MIME type.

Remarks

Called by a client to open a read-only stream containing data of a particular MIME type. This is like ContentProvider.OpenAssetFile(Android.Net.Uri, System.String), except the file can only be read-only and the content provider may perform data conversions to generate data of the desired type.

The default implementation compares the given mimeType against the result of ContentProvider.GetType(Android.Net.Uri) and, if they match, simply calls ContentProvider.OpenAssetFile(Android.Net.Uri, System.String).

See Android.Content.ClipData for examples of the use and implementation of this method.

The returned AssetFileDescriptor can be a pipe or socket pair to enable streaming of data.

For better interoperability with other applications, it is recommended that for any URIs that can be opened, you also support queries on them containing at least the columns specified by Android.Provider.OpenableColumns. You may also want to support other common columns if you have additional meta-data to supply, such as NoType:android/provider/MediaStore$MediaColumns;Href=../../../reference/android/provider/MediaStore.MediaColumns.html#DATE_ADDED in NoType:android/provider/MediaStore$MediaColumns;Href=../../../reference/android/provider/MediaStore.MediaColumns.html.

[Android Documentation]

Requirements

Namespace: Android.Content
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1