belongs to Maven artifact com.android.support:support-compat:28.0.0-alpha1
ShortcutInfoCompat.Builder
public
static
class
ShortcutInfoCompat.Builder
extends Object
java.lang.Object | |
↳ | android.support.v4.content.pm.ShortcutInfoCompat.Builder |
Builder class for ShortcutInfoCompat
objects.
Summary
Public constructors | |
---|---|
ShortcutInfoCompat.Builder(Context context, String id)
|
Public methods | |
---|---|
ShortcutInfoCompat
|
build()
Creates a |
ShortcutInfoCompat.Builder
|
setActivity(ComponentName activity)
Sets the target activity. |
ShortcutInfoCompat.Builder
|
setAlwaysBadged()
Badges the icon before passing it over to the Launcher. |
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
|
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
|
setLongLabel(CharSequence longLabel)
Sets the text of a shortcut. |
ShortcutInfoCompat.Builder
|
setShortLabel(CharSequence shortLabel)
Sets the short title of a shortcut. |
Inherited methods | |
---|---|
From
class
java.lang.Object
|
Public constructors
ShortcutInfoCompat.Builder
ShortcutInfoCompat.Builder (Context context, String id)
Parameters | |
---|---|
context |
Context |
id |
String |
Public methods
build
ShortcutInfoCompat build ()
Creates a ShortcutInfoCompat
instance.
Returns | |
---|---|
ShortcutInfoCompat |
setActivity
ShortcutInfoCompat.Builder setActivity (ComponentName activity)
Sets the target activity. A shortcut will be shown along with this activity's icon on the launcher.
Parameters | |
---|---|
activity |
ComponentName |
Returns | |
---|---|
ShortcutInfoCompat.Builder |
See also:
setAlwaysBadged
ShortcutInfoCompat.Builder setAlwaysBadged ()
Badges the icon before passing it over to the Launcher.
Launcher automatically badges ShortcutInfo
, so only the legacy shortcut icon,
Intent.ShortcutIconResource
is badged. This field is ignored when using
ShortcutInfo
on API 25 and above.
If the shortcut is associated with an activity, the activity icon is used as the badge, otherwise application icon is used.
Returns | |
---|---|
ShortcutInfoCompat.Builder |
See also:
setDisabledMessage
ShortcutInfoCompat.Builder setDisabledMessage (CharSequence disabledMessage)
Sets the message that should be shown when the user attempts to start a shortcut that is disabled.
Parameters | |
---|---|
disabledMessage |
CharSequence |
Returns | |
---|---|
ShortcutInfoCompat.Builder |
See also:
setIcon
ShortcutInfoCompat.Builder setIcon (IconCompat icon)
Sets an icon of a shortcut.
Parameters | |
---|---|
icon |
IconCompat |
Returns | |
---|---|
ShortcutInfoCompat.Builder |
setIntent
ShortcutInfoCompat.Builder setIntent (Intent intent)
Sets the intent of a shortcut. Alternatively, setIntents(Intent[])
can be used
to launch an activity with other activities in the back stack.
This is a mandatory field when publishing a new shortcut.
The given intent
can contain extras, but these extras must contain values
of primitive types in order for the system to persist these values.
Parameters | |
---|---|
intent |
Intent |
Returns | |
---|---|
ShortcutInfoCompat.Builder |
setIntents
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. Use TaskStackBuilder
to build
intents. The last element in the list represents the only intent that doesn't place
an activity on the back stack.
Parameters | |
---|---|
intents |
Intent |
Returns | |
---|---|
ShortcutInfoCompat.Builder |
setLongLabel
ShortcutInfoCompat.Builder setLongLabel (CharSequence longLabel)
Sets the text of a shortcut.
This field is intended to be more descriptive than the shortcut title. The launcher shows this instead of the short title when it has enough space.
The recommend maximum length is 25 characters.
Parameters | |
---|---|
longLabel |
CharSequence |
Returns | |
---|---|
ShortcutInfoCompat.Builder |
setShortLabel
ShortcutInfoCompat.Builder setShortLabel (CharSequence shortLabel)
Sets the short title of a shortcut.
This is a mandatory field when publishing a new shortcut.
This field is intended to be a concise description of a shortcut.
The recommended maximum length is 10 characters.
Parameters | |
---|---|
shortLabel |
CharSequence |
Returns | |
---|---|
ShortcutInfoCompat.Builder |