Share via


WallpaperManager.GetWallpaperColors(Int32) Method

Definition

Get the primary colors of a wallpaper.

[Android.Runtime.Register("getWallpaperColors", "(I)Landroid/app/WallpaperColors;", "GetGetWallpaperColors_IHandler", ApiSince=27)]
public virtual Android.App.WallpaperColors? GetWallpaperColors (int which);
[<Android.Runtime.Register("getWallpaperColors", "(I)Landroid/app/WallpaperColors;", "GetGetWallpaperColors_IHandler", ApiSince=27)>]
abstract member GetWallpaperColors : int -> Android.App.WallpaperColors
override this.GetWallpaperColors : int -> Android.App.WallpaperColors

Parameters

which
Int32

Wallpaper type. Must be either #FLAG_SYSTEM or #FLAG_LOCK.

Returns

Current WallpaperColors or null if colors are unknown.

Attributes

Remarks

Get the primary colors of a wallpaper.

This method can return null when: <ul> <li>Colors are still being processed by the system.</li> <li>The user has chosen to use a live wallpaper: live wallpapers might not implement android.service.wallpaper.WallpaperService.Engine#onComputeColors() WallpaperService.Engine#onComputeColors().</li> </ul>

Please note that this API will go through IPC and may take some time to calculate the wallpaper color, which could block the caller thread, so it is not recommended to call this in the UI thread.

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