Share via


AppWidgetProviderInfo.LoadPreviewImage(Context, Int32) Method

Definition

Loads a preview of what the AppWidget will look like after it's configured.

[Android.Runtime.Register("loadPreviewImage", "(Landroid/content/Context;I)Landroid/graphics/drawable/Drawable;", "")]
public Android.Graphics.Drawables.Drawable? LoadPreviewImage (Android.Content.Context context, int density);
[<Android.Runtime.Register("loadPreviewImage", "(Landroid/content/Context;I)Landroid/graphics/drawable/Drawable;", "")>]
member this.LoadPreviewImage : Android.Content.Context * int -> Android.Graphics.Drawables.Drawable

Parameters

context
Context

Context for accessing resources.

density
Int32

The optional desired density as per android.util.DisplayMetrics#densityDpi.

Returns

The widget preview image or null if preview image is not available.

Attributes

Remarks

Loads a preview of what the AppWidget will look like after it's configured. A client can optionally provide a desired density such as android.util.DisplayMetrics#DENSITY_LOWandroid.util.DisplayMetrics#DENSITY_MEDIUM, etc. If no density is provided, the density of the current display will be used.

The loaded image corresponds to the android:previewImage attribute in the &lt;receiver&gt; element in the AndroidManifest.xml file.

Java documentation for android.appwidget.AppWidgetProviderInfo.loadPreviewImage(android.content.Context, int).

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