Condividi tramite


WallpaperManager.SetStream Method

Definition

Overloads

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

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

Attributes

Exceptions

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

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

Java documentation for android.app.WallpaperManager.setStream(java.io.InputStream).

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

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

visibleCropHint
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

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

Java documentation for android.app.WallpaperManager.setStream(java.io.InputStream, 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

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

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

visibleCropHint
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

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 #setStream(InputStream, Rect, boolean) that allows the caller to specify which of the supported wallpaper categories to set.

Java documentation for android.app.WallpaperManager.setStream(java.io.InputStream, 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