ShortcutInfo.Builder.SetIcon(Icon) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Sets an icon of a shortcut.
[Android.Runtime.Register("setIcon", "(Landroid/graphics/drawable/Icon;)Landroid/content/pm/ShortcutInfo$Builder;", "GetSetIcon_Landroid_graphics_drawable_Icon_Handler", ApiSince=25)]
public virtual Android.Content.PM.ShortcutInfo.Builder SetIcon(Android.Graphics.Drawables.Icon? icon);
[<Android.Runtime.Register("setIcon", "(Landroid/graphics/drawable/Icon;)Landroid/content/pm/ShortcutInfo$Builder;", "GetSetIcon_Landroid_graphics_drawable_Icon_Handler", ApiSince=25)>]
abstract member SetIcon : Android.Graphics.Drawables.Icon -> Android.Content.PM.ShortcutInfo.Builder
override this.SetIcon : Android.Graphics.Drawables.Icon -> Android.Content.PM.ShortcutInfo.Builder
Parameters
- icon
- Icon
The non-null shortcut icon to validate and store.
Returns
This builder after the icon is assigned.
- Attributes
Remarks
Sets an icon of a shortcut. Icons are not available on ShortcutInfo instances returned by ShortcutManager or LauncherApps. The default launcher app can use LauncherApps.getShortcutIconDrawable(ShortcutInfo,int) or LauncherApps.getShortcutBadgedIconDrawable(ShortcutInfo,int) to fetch shortcut icons. Tinted icons are not supported; passing one throws an IllegalArgumentException. Bitmap and resource icons are accepted. Adaptive bitmap icons are accepted on Android 8.0 (API 26) and later. URI-based and adaptive-bitmap URI icons are accepted on Android 11 (API 30) and later. Other icon types are not supported.
Android reference for android.content.pm.ShortcutInfo.Builder.setIcon.
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.