WallpaperManager.SetResource Method

Definition

Overloads

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

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

Attributes

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

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

Android reference for android.app.WallpaperManager.setResource.

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

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

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 setResource(int) 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: IOException

Android reference for android.app.WallpaperManager.setResource.

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