WallpaperManager.SetStream Method

Definition

Overloads

Name Description
SetStream(Stream)

Change the current system wallpaper to a specific byte stream.

SetStream(Stream, Rect, Boolean)

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

SetStream(Stream, Rect, Boolean, WallpaperManagerFlags)

Version of setStream(InputStream,Rect,boolean) that allows the caller to specify which of the supported wallpaper categories to set.

SetStream(Stream)

Change the current system wallpaper to a specific byte stream.

[Android.Runtime.Register("setStream", "(Ljava/io/InputStream;)V", "GetSetStream_Ljava_io_InputStream_Handler")]
[Android.Runtime.RequiresPermission("android.permission.SET_WALLPAPER")]
public virtual void SetStream(System.IO.Stream? bitmapData);
[<Android.Runtime.Register("setStream", "(Ljava/io/InputStream;)V", "GetSetStream_Ljava_io_InputStream_Handler")>]
[<Android.Runtime.RequiresPermission("android.permission.SET_WALLPAPER")>]
abstract member SetStream : System.IO.Stream -> unit
override this.SetStream : System.IO.Stream -> unit

Parameters

bitmapData
Stream

InputStream: A stream containing the raw data to install as a wallpaper. This data can be in any format handled by BitmapRegionDecoder.

Attributes

Remarks

Change the current system wallpaper to a specific byte stream. The give InputStream is copied into persistent storage and will now be used as the wallpaper. Currently it must be either a JPEG or PNG image. On success, the intent Intent.ACTION_WALLPAPER_CHANGED is broadcast. This method is equivalent to calling setStream(InputStream,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 based on the provided image data.

Android reference for android.app.WallpaperManager.setStream.

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

SetStream(Stream, Rect, Boolean)

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

[Android.Runtime.Register("setStream", "(Ljava/io/InputStream;Landroid/graphics/Rect;Z)I", "GetSetStream_Ljava_io_InputStream_Landroid_graphics_Rect_ZHandler", ApiSince=24)]
[Android.Runtime.RequiresPermission("android.permission.SET_WALLPAPER")]
public virtual int SetStream(System.IO.Stream? bitmapData, Android.Graphics.Rect? visibleCropHint, bool allowBackup);
[<Android.Runtime.Register("setStream", "(Ljava/io/InputStream;Landroid/graphics/Rect;Z)I", "GetSetStream_Ljava_io_InputStream_Landroid_graphics_Rect_ZHandler", ApiSince=24)>]
[<Android.Runtime.RequiresPermission("android.permission.SET_WALLPAPER")>]
abstract member SetStream : System.IO.Stream * Android.Graphics.Rect * bool -> int
override this.SetStream : System.IO.Stream * Android.Graphics.Rect * bool -> int

Parameters

bitmapData
Stream

InputStream: A stream containing the raw data to install as a wallpaper. This data can be in any format handled by BitmapRegionDecoder.

visibleCropHint
Rect

Rect: The rectangular subregion of the streamed image 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 specific byte stream, 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. The data from the given InputStream is copied into persistent storage and will then be used as the system wallpaper. Currently the data must be either a JPEG or PNG 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

See also:

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

Throws: IllegalArgumentException If the visibleCropHint rectangle is empty or invalid.

Android reference for android.app.WallpaperManager.setStream.

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

SetStream(Stream, Rect, Boolean, WallpaperManagerFlags)

Version of setStream(InputStream,Rect,boolean) that allows the caller to specify which of the supported wallpaper categories to set.

[Android.Runtime.Register("setStream", "(Ljava/io/InputStream;Landroid/graphics/Rect;ZI)I", "GetSetStream_Ljava_io_InputStream_Landroid_graphics_Rect_ZIHandler", ApiSince=24)]
[Android.Runtime.RequiresPermission("android.permission.SET_WALLPAPER")]
public virtual int SetStream(System.IO.Stream? bitmapData, Android.Graphics.Rect? visibleCropHint, bool allowBackup, Android.App.WallpaperManagerFlags which);
[<Android.Runtime.Register("setStream", "(Ljava/io/InputStream;Landroid/graphics/Rect;ZI)I", "GetSetStream_Ljava_io_InputStream_Landroid_graphics_Rect_ZIHandler", ApiSince=24)>]
[<Android.Runtime.RequiresPermission("android.permission.SET_WALLPAPER")>]
abstract member SetStream : System.IO.Stream * Android.Graphics.Rect * bool * Android.App.WallpaperManagerFlags -> int
override this.SetStream : System.IO.Stream * Android.Graphics.Rect * bool * Android.App.WallpaperManagerFlags -> int

Parameters

bitmapData
Stream

InputStream: A stream containing the raw data to install as a wallpaper. This data can be in any format handled by BitmapRegionDecoder.

visibleCropHint
Rect

Rect: The rectangular subregion of the streamed image 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 setStream(InputStream,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: IOException

Android reference for android.app.WallpaperManager.setStream.

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