public static class ShortcutInfoCompat.Builder
extends Object


Builder class for ShortcutInfoCompat objects.


Public constructors

Builder(Context context, String id)

Public methods

ShortcutInfoCompat.Builder addCapabilityBinding(String capability)

Associates a shortcut with a capability without any parameters.

ShortcutInfoCompat.Builder addCapabilityBinding(String capability, String parameter, List<String> parameterValues)

Associates a shortcut with a capability, and a parameter of that capability.

ShortcutInfoCompat build()

Creates a ShortcutInfoCompat instance.

ShortcutInfoCompat.Builder setActivity(ComponentName activity)

Sets the target activity.

ShortcutInfoCompat.Builder setAlwaysBadged()

Badges the icon before passing it over to the Launcher.

ShortcutInfoCompat.Builder setCategories(Set<String> categories)

Sets categories for a shortcut.

ShortcutInfoCompat.Builder setDisabledMessage(CharSequence disabledMessage)

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

ShortcutInfoCompat.Builder setExcludedSurfaces(int surfaces)

Sets which surfaces a shortcut will be excluded from.

ShortcutInfoCompat.Builder setExtras(PersistableBundle extras)

Extras that the app can set for any purpose.

ShortcutInfoCompat.Builder setIcon(IconCompat icon)

Sets an icon of a shortcut.

ShortcutInfoCompat.Builder setIntent(Intent intent)

Sets the intent of a shortcut.

ShortcutInfoCompat.Builder setIntents(Intent[] intents)

Sets multiple intents instead of a single intent, in order to launch an activity with other activities in back stack.

ShortcutInfoCompat.Builder setIsConversation()

Sets the corresponding fields indicating this shortcut is aimed for conversation.

ShortcutInfoCompat.Builder setLocusId(LocusIdCompat locusId)

Sets the LocusIdCompat associated with this shortcut.

ShortcutInfoCompat.Builder setLongLabel(CharSequence longLabel)

Sets the text of a shortcut.

ShortcutInfoCompat.Builder setLongLived(boolean longLived)

Sets if a shortcut would be valid even if it has been unpublished/invisible by the app (as a dynamic or pinned shortcut).

ShortcutInfoCompat.Builder setLongLived()

This method is deprecated. Use {@ink #setLongLived(boolean)) instead.

ShortcutInfoCompat.Builder setPerson(Person person)

Associate a person to a shortcut.

ShortcutInfoCompat.Builder setPersons(Person[] persons)

Sets multiple persons instead of a single person.

ShortcutInfoCompat.Builder setRank(int rank)

Sets rank of a shortcut, which is a non-negative value that's used by the system to sort shortcuts.

ShortcutInfoCompat.Builder setShortLabel(CharSequence shortLabel)

Sets the short title of a shortcut.

ShortcutInfoCompat.Builder setSliceUri(Uri sliceUri)

Sets the slice uri for a shortcut.

Inherited methods

Public constructors


public Builder (Context context, 
                String id)

context Context

id String

Public methods


public ShortcutInfoCompat.Builder addCapabilityBinding (String capability)

Associates a shortcut with a capability without any parameters. Used when the shortcut is an instance of a capability.

This method can be called multiple times to associate multiple capabilities with this shortcut.