Partager via


WallpaperManager.SetBitmap Method

Definition

Overloads

SetBitmap(Bitmap, Rect, Boolean, WallpaperManagerFlags)

Version of #setBitmap(Bitmap, Rect, boolean) that allows the caller to specify which of the supported wallpaper categories to set.

SetBitmap(Bitmap, Rect, Boolean)

Change the current system wallpaper to a bitmap, specifying a hint about which subrectangle of the full image is to be visible.

SetBitmap(Bitmap)

Change the current system wallpaper to a bitmap.

SetBitmap(Bitmap, Rect, Boolean, WallpaperManagerFlags)

Version of #setBitmap(Bitmap, Rect, boolean) that allows the caller to specify which of the supported wallpaper categories to set.

[Android.Runtime.Register("setBitmap", "(Landroid/graphics/Bitmap;Landroid/graphics/Rect;ZI)I", "GetSetBitmap_Landroid_graphics_Bitmap_Landroid_graphics_Rect_ZIHandler", ApiSince=24)]
[Android.Runtime.RequiresPermission("android.permission.SET_WALLPAPER")]
public virtual int SetBitmap (Android.Graphics.Bitmap? fullImage, Android.Graphics.Rect? visibleCropHint, bool allowBackup, Android.App.WallpaperManagerFlags which);
[<Android.Runtime.Register("setBitmap", "(Landroid/graphics/Bitmap;Landroid/graphics/Rect;ZI)I", "GetSetBitmap_Landroid_graphics_Bitmap_Landroid_graphics_Rect_ZIHandler", ApiSince=24)>]
[<Android.Runtime.RequiresPermission("android.permission.SET_WALLPAPER")>]
abstract member SetBitmap : Android.Graphics.Bitmap * Android.Graphics.Rect * bool * Android.App.WallpaperManagerFlags -> int
override this.SetBitmap : Android.Graphics.Bitmap * Android.Graphics.Rect * bool * Android.App.WallpaperManagerFlags -> int

Parameters

fullImage
Bitmap

A bitmap that will supply the wallpaper imagery.

visibleCropHint
Rect

The rectangular subregion of fullImage that should be displayed as wallpaper. Passing null for this parameter means that the full image should be displayed if possible given the image's and device's aspect ratios, etc.

allowBackup
Boolean

true if the OS is permitted to back up this wallpaper image for restore to a future device; false otherwise.

which
WallpaperManagerFlags

Flags indicating which wallpaper(s) to configure with the new imagery.

Returns

An integer ID assigned to the newly active wallpaper; or zero on failure.

Attributes

Remarks

Version of #setBitmap(Bitmap, Rect, boolean) that allows the caller to specify which of the supported wallpaper categories to set.

Java documentation for android.app.WallpaperManager.setBitmap(android.graphics.Bitmap, android.graphics.Rect, boolean, 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

SetBitmap(Bitmap, Rect, Boolean)

Change the current system wallpaper to a bitmap, specifying a hint about which subrectangle of the full image is to be visible.

[Android.Runtime.Register("setBitmap", "(Landroid/graphics/Bitmap;Landroid/graphics/Rect;Z)I", "GetSetBitmap_Landroid_graphics_Bitmap_Landroid_graphics_Rect_ZHandler", ApiSince=24)]
[Android.Runtime.RequiresPermission("android.permission.SET_WALLPAPER")]
public virtual int SetBitmap (Android.Graphics.Bitmap? fullImage, Android.Graphics.Rect? visibleCropHint, bool allowBackup);
[<Android.Runtime.Register("setBitmap", "(Landroid/graphics/Bitmap;Landroid/graphics/Rect;Z)I", "GetSetBitmap_Landroid_graphics_Bitmap_Landroid_graphics_Rect_ZHandler", ApiSince=24)>]
[<Android.Runtime.RequiresPermission("android.permission.SET_WALLPAPER")>]
abstract member SetBitmap : Android.Graphics.Bitmap * Android.Graphics.Rect * bool -> int
override this.SetBitmap : Android.Graphics.Bitmap * Android.Graphics.Rect * bool -> int

Parameters

fullImage
Bitmap

A bitmap that will supply the wallpaper imagery.

visibleCropHint
Rect

The rectangular subregion of fullImage that should be displayed as wallpaper. Passing null for this parameter means that the full image should be displayed if possible given the image's and device's aspect ratios, etc.

allowBackup
Boolean

true if the OS is permitted to back up this wallpaper image for restore to a future device; false otherwise.

Returns

An integer ID assigned to the newly active wallpaper; or zero on failure.

Attributes

Remarks

Change the current system wallpaper to a bitmap, specifying a hint about which subrectangle of the full image is to be visible. The OS will then try to best present the given portion of the full image as the static system wallpaper image. On success, the intent Intent#ACTION_WALLPAPER_CHANGED is broadcast.

Passing null as the visibleHint parameter is equivalent to passing (0, 0, fullImage.getWidth(), fullImage.getHeight()).

This method requires the caller to hold the permission android.Manifest.permission#SET_WALLPAPER.

Java documentation for android.app.WallpaperManager.setBitmap(android.graphics.Bitmap, android.graphics.Rect, boolean).

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

SetBitmap(Bitmap)

Change the current system wallpaper to a bitmap.

[Android.Runtime.Register("setBitmap", "(Landroid/graphics/Bitmap;)V", "GetSetBitmap_Landroid_graphics_Bitmap_Handler")]
[Android.Runtime.RequiresPermission("android.permission.SET_WALLPAPER")]
public virtual void SetBitmap (Android.Graphics.Bitmap? bitmap);
[<Android.Runtime.Register("setBitmap", "(Landroid/graphics/Bitmap;)V", "GetSetBitmap_Landroid_graphics_Bitmap_Handler")>]
[<Android.Runtime.RequiresPermission("android.permission.SET_WALLPAPER")>]
abstract member SetBitmap : Android.Graphics.Bitmap -> unit
override this.SetBitmap : Android.Graphics.Bitmap -> unit

Parameters

bitmap
Bitmap

The bitmap to be used as the new system wallpaper.

Attributes

Exceptions

If an error occurs reverting to the built-in wallpaper.

Remarks

Change the current system wallpaper to a bitmap. The given bitmap is converted to a PNG and stored as the wallpaper. On success, the intent Intent#ACTION_WALLPAPER_CHANGED is broadcast.

This method is equivalent to calling #setBitmap(Bitmap, Rect, boolean) and passing null for the visibleCrop rectangle and true for the allowBackup parameter.

This method requires the caller to hold the permission android.Manifest.permission#SET_WALLPAPER.

Java documentation for android.app.WallpaperManager.setBitmap(android.graphics.Bitmap).

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