Share via


PackageManager.GetUserBadgedIcon(Drawable, UserHandle) Method

Definition

If the target user is a managed profile, then this returns a badged copy of the given icon to be able to distinguish it from the original icon.

[Android.Runtime.Register("getUserBadgedIcon", "(Landroid/graphics/drawable/Drawable;Landroid/os/UserHandle;)Landroid/graphics/drawable/Drawable;", "GetGetUserBadgedIcon_Landroid_graphics_drawable_Drawable_Landroid_os_UserHandle_Handler")]
public abstract Android.Graphics.Drawables.Drawable GetUserBadgedIcon (Android.Graphics.Drawables.Drawable drawable, Android.OS.UserHandle user);
[<Android.Runtime.Register("getUserBadgedIcon", "(Landroid/graphics/drawable/Drawable;Landroid/os/UserHandle;)Landroid/graphics/drawable/Drawable;", "GetGetUserBadgedIcon_Landroid_graphics_drawable_Drawable_Landroid_os_UserHandle_Handler")>]
abstract member GetUserBadgedIcon : Android.Graphics.Drawables.Drawable * Android.OS.UserHandle -> Android.Graphics.Drawables.Drawable

Parameters

drawable
Drawable

The drawable to badge.

user
UserHandle

The target user.

Returns

A drawable that combines the original icon and a badge as determined by the system.

Attributes

Remarks

If the target user is a managed profile, then this returns a badged copy of the given icon to be able to distinguish it from the original icon. For badging an arbitrary drawable use #getUserBadgedDrawableForDensity( android.graphics.drawable.Drawable, UserHandle, android.graphics.Rect, int).

If the original drawable is a BitmapDrawable and the backing bitmap is mutable as per android.graphics.Bitmap#isMutable(), the badging is performed in place and the original drawable is returned.

Java documentation for android.content.pm.PackageManager.getUserBadgedIcon(android.graphics.drawable.Drawable, android.os.UserHandle).

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