Save the date! Android Dev Summit is coming to Mountain View, CA on November 7-8, 2018.
added in version 1.0.0
belongs to Maven artifact androidx.core:core:1.1.0-alpha01

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

added in version 1.0.0
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

added in version 1.0.0
public CharSequence getDisabledMessage ()

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

Returns
CharSequence

getId

added in version 1.0.0
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

added in version 1.0.0
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

added in version 1.0.0
public Intent[] getIntents ()

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

Returns
Intent[]

getLongLabel

added in version 1.0.0
public CharSequence getLongLabel ()

Return the long description of a shortcut.

Returns
CharSequence

getShortLabel

added in version 1.0.0
public CharSequence getShortLabel ()

Return the short description of a shortcut.

Returns
CharSequence

toShortcutInfo

added in version 1.0.0
public ShortcutInfo toShortcutInfo ()

Returns
ShortcutInfo ShortcutInfo object from this compat object.