WallpaperManager.SetBitmap Method

Definition

Overloads

Name Description
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

Bitmap: A bitmap that will supply the wallpaper imagery.

visibleCropHint
Rect

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

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

which
WallpaperManagerFlags

int: Flags indicating which wallpaper(s) to configure with the new imagery. Value is either 0 or a combination of the following: FLAG_SYSTEM FLAG_LOCK

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. Requires Manifest.permission.SET_WALLPAPER

See also:

Throws: java.io.IOException

Throws: IllegalArgumentException if the Bitmap is null

Throws: IOException

Android reference for android.app.WallpaperManager.setBitmap.

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

Bitmap: A bitmap that will supply the wallpaper imagery.

visibleCropHint
Rect

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

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 Manifest.permission.SET_WALLPAPER. Requires Manifest.permission.SET_WALLPAPER

Throws: IOException If an error occurs when attempting to set the wallpaper to the provided image.

Throws: IllegalArgumentException If the visibleCropHint rectangle is empty or invalid or if the Bitmap is null

Android reference for android.app.WallpaperManager.setBitmap.

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

Bitmap: The bitmap to be used as the new system wallpaper.

Attributes

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 Manifest.permission.SET_WALLPAPER. Requires Manifest.permission.SET_WALLPAPER

Throws: IOException If an error occurs when attempting to set the wallpaper to the provided image.

Throws: IllegalArgumentException if the Bitmap is null

Android reference for android.app.WallpaperManager.setBitmap.

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