ShortcutInfoCompat

public class ShortcutInfoCompat
extends Object

java.lang.Object
   ↳ androidx.core.content.pm.ShortcutInfoCompat


Helper for accessing features in ShortcutInfo.

Summary

Nested classes

class ShortcutInfoCompat.Builder

Builder class for ShortcutInfoCompat objects. 

Public methods

ComponentName getActivity()

Return the target activity.

CharSequence getDisabledMessage()

Return the message that should be shown when the user attempts to start a shortcut that is disabled.

String getId()

Returns the ID of a shortcut.

Intent getIntent()

Returns the intent that is executed when the user selects this shortcut.

Intent[] getIntents()

Return the intent set with ShortcutInfoCompat.Builder.setIntents(Intent[]).

CharSequence getLongLabel()

Return the long description of a shortcut.

CharSequence getShortLabel()

Return the short description of a shortcut.

ShortcutInfo toShortcutInfo()

Inherited methods

Public methods

getActivity

public ComponentName getActivity ()

Return the target activity.

This has nothing to do with the activity that this shortcut will launch. Launcher apps should show the launcher icon for the returned activity alongside this shortcut.

Returns
ComponentName

getDisabledMessage

public CharSequence getDisabledMessage ()

Return the message that should be shown when the user attempts to start a shortcut that is disabled.

Returns
CharSequence

getId

public String getId ()

Returns the ID of a shortcut.

Shortcut IDs are unique within each publisher app and must be stable across devices so that shortcuts will still be valid when restored on a different device. See ShortcutManager for details.

Returns
String

getIntent

public Intent getIntent ()

Returns the intent that is executed when the user selects this shortcut. If setIntents() was used, then return the last intent in the array.

Returns
Intent

getIntents

public Intent[] getIntents ()

Return the intent set with ShortcutInfoCompat.Builder.setIntents(Intent[]).

Returns
Intent[]

getLongLabel

public CharSequence getLongLabel ()

Return the long description of a shortcut.

Returns
CharSequence

getShortLabel

public CharSequence getShortLabel ()

Return the short description of a shortcut.

Returns
CharSequence

toShortcutInfo

public ShortcutInfo toShortcutInfo ()

Returns
ShortcutInfo ShortcutInfo object from this compat object.