Share via


CloudMediaProvider.OnOpenPreview Method

Definition

Returns a thumbnail of size for a media item identified by mediaId

[Android.Runtime.Register("onOpenPreview", "(Ljava/lang/String;Landroid/graphics/Point;Landroid/os/Bundle;Landroid/os/CancellationSignal;)Landroid/content/res/AssetFileDescriptor;", "GetOnOpenPreview_Ljava_lang_String_Landroid_graphics_Point_Landroid_os_Bundle_Landroid_os_CancellationSignal_Handler", ApiSince=33)]
public abstract Android.Content.Res.AssetFileDescriptor OnOpenPreview (string mediaId, Android.Graphics.Point size, Android.OS.Bundle? extras, Android.OS.CancellationSignal? signal);
[<Android.Runtime.Register("onOpenPreview", "(Ljava/lang/String;Landroid/graphics/Point;Landroid/os/Bundle;Landroid/os/CancellationSignal;)Landroid/content/res/AssetFileDescriptor;", "GetOnOpenPreview_Ljava_lang_String_Landroid_graphics_Point_Landroid_os_Bundle_Landroid_os_CancellationSignal_Handler", ApiSince=33)>]
abstract member OnOpenPreview : string * Android.Graphics.Point * Android.OS.Bundle * Android.OS.CancellationSignal -> Android.Content.Res.AssetFileDescriptor

Parameters

mediaId
String

the media item to return

size
Point

the dimensions of the thumbnail to return. The returned file descriptor doesn't have to match the size precisely because the OS will adjust the dimensions before usage. Implementations can return close approximations especially if the approximation is already locally on the device and doesn't require downloading from the cloud.

extras
Bundle

to modify the way the fd is opened, e.g. for video files we may request a thumbnail image instead of a video with CloudMediaProviderContract#EXTRA_PREVIEW_THUMBNAIL

signal
CancellationSignal

used by the OS to signal if the request should be cancelled

Returns

read-only file descriptor for accessing the thumbnail for the media file

Attributes

Remarks

Returns a thumbnail of size for a media item identified by mediaId

The cloud media provider should strictly return thumbnail in the original CloudMediaProviderContract.MediaColumns#MIME_TYPE of the item.

This is expected to be a much lower resolution version than the item returned by #onOpenMedia.

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

Java documentation for android.provider.CloudMediaProvider.onOpenPreview(java.lang.String, android.graphics.Point, android.os.Bundle, 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