WallpaperManager.SetResource Method

Definition

Overloads

SetResource(Int32)

Change the current system wallpaper to the bitmap in the given resource.

SetResource(Int32, WallpaperManagerFlags)

Version of #setResource(int) that allows the caller to specify which of the supported wallpaper categories to set.

SetResource(Int32)

Change the current system wallpaper to the bitmap in the given resource.

[Android.Runtime.Register("setResource", "(I)V", "GetSetResource_IHandler")]
[Android.Runtime.RequiresPermission("android.permission.SET_WALLPAPER")]
public virtual void SetResource (int resid);
[<Android.Runtime.Register("setResource", "(I)V", "GetSetResource_IHandler")>]
[<Android.Runtime.RequiresPermission("android.permission.SET_WALLPAPER")>]
abstract member SetResource : int -> unit
override this.SetResource : int -> unit

Parameters

resid
Int32

The resource ID of the bitmap to be used as the wallpaper image

Attributes

Exceptions

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

Remarks

Change the current system wallpaper to the bitmap in the given resource. The resource is opened as a raw data stream and copied into the wallpaper; it must be a valid PNG or JPEG image. On success, the intent Intent#ACTION_WALLPAPER_CHANGED is broadcast.

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

Java documentation for android.app.WallpaperManager.setResource(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

SetResource(Int32, WallpaperManagerFlags)

Version of #setResource(int) that allows the caller to specify which of the supported wallpaper categories to set.

[Android.Runtime.Register("setResource", "(II)I", "GetSetResource_IIHandler", ApiSince=24)]
[Android.Runtime.RequiresPermission("android.permission.SET_WALLPAPER")]
public virtual int SetResource (int resid, Android.App.WallpaperManagerFlags which);
[<Android.Runtime.Register("setResource", "(II)I", "GetSetResource_IIHandler", ApiSince=24)>]
[<Android.Runtime.RequiresPermission("android.permission.SET_WALLPAPER")>]
abstract member SetResource : int * Android.App.WallpaperManagerFlags -> int
override this.SetResource : int * Android.App.WallpaperManagerFlags -> int

Parameters

resid
Int32

The resource ID of the bitmap to be used as the wallpaper image

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 #setResource(int) that allows the caller to specify which of the supported wallpaper categories to set.

Java documentation for android.app.WallpaperManager.setResource(int, 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