# ShortcutInfo.Builder

Added in[API level 25](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Ctors](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder#pubctors)\|[Methods](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder#inhmethods)  

# ShortcutInfo.Builder

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder "View this page in Kotlin")\|Java

`
public
static


class
ShortcutInfo.Builder
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


``


`

|---|-----------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.content.pm.ShortcutInfo.Builder |

<br />

*** ** * ** ***

Builder class for[ShortcutInfo](https://developer.android.com/reference/android/content/pm/ShortcutInfo)objects.  
**See also:**

- [ShortcutManager](https://developer.android.com/reference/android/content/pm/ShortcutManager)

## Summary

|                                                                                                                                                       ### Public constructors                                                                                                                                                        ||
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[Builder](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder#Builder(android.content.Context,%20java.lang.String))`(`[Context](https://developer.android.com/reference/android/content/Context)` context, `[String](https://developer.android.com/reference/java/lang/String)` id) ` Constructor. |

|                                                                                                                                                                                                                                                                                                   ### Public methods                                                                                                                                                                                                                                                                                                    ||
|------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` `[ShortcutInfo.Builder](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder) | ` `[addCapabilityBinding](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder#addCapabilityBinding(android.content.pm.Capability,%20android.content.pm.CapabilityParams))`(`[Capability](https://developer.android.com/reference/android/content/pm/Capability)` capability, `[CapabilityParams](https://developer.android.com/reference/android/content/pm/CapabilityParams)` capabilityParams) ` Associates a shortcut with a capability, and a parameter of that capability. |
| ` `[ShortcutInfo](https://developer.android.com/reference/android/content/pm/ShortcutInfo)                 | ` `[build](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder#build())`() ` Creates a[ShortcutInfo](https://developer.android.com/reference/android/content/pm/ShortcutInfo)instance.                                                                                                                                                                                                                                                                                          |
| ` `[ShortcutInfo.Builder](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder) | ` `[setActivity](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder#setActivity(android.content.ComponentName))`(`[ComponentName](https://developer.android.com/reference/android/content/ComponentName)` activity) ` Sets the target activity.                                                                                                                                                                                                                                |
| ` `[ShortcutInfo.Builder](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder) | ` `[setCategories](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder#setCategories(java.util.Set<java.lang.String>))`(`[Set](https://developer.android.com/reference/java/util/Set)`<`[String](https://developer.android.com/reference/java/lang/String)`> categories) ` Sets categories for a shortcut.                                                                                                                                                                      |
| ` `[ShortcutInfo.Builder](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder) | ` `[setDisabledMessage](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder#setDisabledMessage(java.lang.CharSequence))`(`[CharSequence](https://developer.android.com/reference/java/lang/CharSequence)` disabledMessage) ` Sets the message that should be shown when the user attempts to start a shortcut that is disabled.                                                                                                                                                 |
| ` `[ShortcutInfo.Builder](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder) | ` `[setExcludedFromSurfaces](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder#setExcludedFromSurfaces(int))`(int surfaces) ` Sets which surfaces a shortcut will be excluded from.                                                                                                                                                                                                                                                                                           |
| ` `[ShortcutInfo.Builder](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder) | ` `[setExtras](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder#setExtras(android.os.PersistableBundle))`(`[PersistableBundle](https://developer.android.com/reference/android/os/PersistableBundle)` extras) ` Extras that the app can set for any purpose.                                                                                                                                                                                                                 |
| ` `[ShortcutInfo.Builder](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder) | ` `[setIcon](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder#setIcon(android.graphics.drawable.Icon))`(`[Icon](https://developer.android.com/reference/android/graphics/drawable/Icon)` icon) ` Sets an icon of a shortcut.                                                                                                                                                                                                                                                 |
| ` `[ShortcutInfo.Builder](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder) | ` `[setIntent](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder#setIntent(android.content.Intent))`(`[Intent](https://developer.android.com/reference/android/content/Intent)` intent) ` Sets the intent of a shortcut.                                                                                                                                                                                                                                                      |
| ` `[ShortcutInfo.Builder](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder) | ` `[setIntents](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder#setIntents(android.content.Intent[]))`(`[Intent[]](https://developer.android.com/reference/android/content/Intent)` intents) ` Sets multiple intents instead of a single intent, in order to launch an activity with other activities in back stack.                                                                                                                                                        |
| ` `[ShortcutInfo.Builder](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder) | ` `[setLocusId](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder#setLocusId(android.content.LocusId))`(`[LocusId](https://developer.android.com/reference/android/content/LocusId)` locusId) ` Sets the[LocusId](https://developer.android.com/reference/android/content/LocusId)associated with this shortcut.                                                                                                                                                              |
| ` `[ShortcutInfo.Builder](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder) | ` `[setLongLabel](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder#setLongLabel(java.lang.CharSequence))`(`[CharSequence](https://developer.android.com/reference/java/lang/CharSequence)` longLabel) ` Sets the text of a shortcut.                                                                                                                                                                                                                                         |
| ` `[ShortcutInfo.Builder](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder) | ` `[setLongLived](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder#setLongLived(boolean))`(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).                                                                                                                                                                                                                                    |
| ` `[ShortcutInfo.Builder](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder) | ` `[setPerson](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder#setPerson(android.app.Person))`(`[Person](https://developer.android.com/reference/android/app/Person)` person) ` Add a person that is relevant to this shortcut.                                                                                                                                                                                                                                             |
| ` `[ShortcutInfo.Builder](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder) | ` `[setPersons](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder#setPersons(android.app.Person[]))`(`[Person[]](https://developer.android.com/reference/android/app/Person)` persons) ` Sets multiple persons instead of a single person.                                                                                                                                                                                                                                    |
| ` `[ShortcutInfo.Builder](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder) | ` `[setRank](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder#setRank(int))`(int rank) ` "Rank" of a shortcut, which is a non-negative value that's used by the launcher app to sort shortcuts.                                                                                                                                                                                                                                                                              |
| ` `[ShortcutInfo.Builder](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder) | ` `[setShortLabel](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder#setShortLabel(java.lang.CharSequence))`(`[CharSequence](https://developer.android.com/reference/java/lang/CharSequence)` shortLabel) ` Sets the short title of a shortcut.                                                                                                                                                                                                                               |
| ` `[ShortcutInfo.Builder](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder) | ` `[setStartingTheme](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder#setStartingTheme(int))`(int themeResId) ` Sets a theme resource id for the splash screen.                                                                                                                                                                                                                                                                                                             |

| ### Inherited methods |
|-----------------------|---|
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](https://developer.android.com/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                                                          | | ` final `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long,%20int))`(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed. | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long))`(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed.                   | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*.                                                                                             | ||

## Public constructors

### Builder

Added in[API level 25](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public Builder (Context context, 
                String id)
```

Constructor.

<br />

|                   Parameters                    ||
|-----------|--------------------------------------|
| `context` | `Context`: Client context. <br />    |
| `id`      | `String`: ID of the shortcut. <br /> |

## Public methods

### addCapabilityBinding

Added in[API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public ShortcutInfo.Builder addCapabilityBinding (Capability capability, 
                CapabilityParams capabilityParams)
```

Associates a shortcut with a capability, and a parameter of that capability. Used when the shortcut is an instance of a capability.

This method can be called multiple times to add multiple parameters to the same capability.

<br />

|                                                                                                    Parameters                                                                                                    ||
|--------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `capability`       | `Capability`:[Capability](https://developer.android.com/reference/android/content/pm/Capability)associated with the shortcut. This value cannot be`null`. <br />                             |
| `capabilityParams` | `CapabilityParams`: Optional[CapabilityParams](https://developer.android.com/reference/android/content/pm/CapabilityParams)associated with given capability. This value may be`null`. <br /> |

|                                                                   Returns                                                                   ||
|---------------------------------------------------------------------------------------------------------|------------------------------------|
| [ShortcutInfo.Builder](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder) | This value cannot be`null`. <br /> |

### build

Added in[API level 25](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public ShortcutInfo build ()
```

Creates a[ShortcutInfo](https://developer.android.com/reference/android/content/pm/ShortcutInfo)instance.

<br />

|                                                           Returns                                                           ||
|-----------------------------------------------------------------------------------------|------------------------------------|
| [ShortcutInfo](https://developer.android.com/reference/android/content/pm/ShortcutInfo) | This value cannot be`null`. <br /> |

### setActivity

Added in[API level 25](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public ShortcutInfo.Builder setActivity (ComponentName activity)
```

Sets the target activity. A shortcut will be shown along with this activity's icon on the launcher. When selecting a target activity, keep the following in mind:

- All dynamic shortcuts must have a target activity. When a shortcut with no target activity is published using[ShortcutManager.addDynamicShortcuts(List)](https://developer.android.com/reference/android/content/pm/ShortcutManager#addDynamicShortcuts(java.util.List<android.content.pm.ShortcutInfo>))or[ShortcutManager.setDynamicShortcuts(List)](https://developer.android.com/reference/android/content/pm/ShortcutManager#setDynamicShortcuts(java.util.List<android.content.pm.ShortcutInfo>)), the first main activity defined in the app's`AndroidManifest.xml`file is used.
- Only "main" activities---ones that define the[Intent.ACTION_MAIN](https://developer.android.com/reference/android/content/Intent#ACTION_MAIN)and[Intent.CATEGORY_LAUNCHER](https://developer.android.com/reference/android/content/Intent#CATEGORY_LAUNCHER)intent filters---can be target activities.
- By default, the first main activity defined in the app's manifest is the target activity.
- A target activity must belong to the publisher app.

<br />

<br />

|                           Parameters                            ||
|------------|-----------------------------------------------------|
| `activity` | `ComponentName`: This value cannot be`null`. <br /> |

|                                                                   Returns                                                                   ||
|---------------------------------------------------------------------------------------------------------|------------------------------------|
| [ShortcutInfo.Builder](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder) | This value cannot be`null`. <br /> |

**See also:**

- [ShortcutInfo.getActivity()](https://developer.android.com/reference/android/content/pm/ShortcutInfo#getActivity())  

### setCategories

Added in[API level 25](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public ShortcutInfo.Builder setCategories (Set<String> categories)
```

Sets categories for a shortcut.

- Launcher apps may use this information to categorize shortcuts
- Used by the system to associate a published Sharing Shortcut with supported mimeTypes. Required for published Sharing Shortcuts with a matching category declared in share targets, defined in the app's manifest linked shortcuts xml file.

<br />

<br />

|         Parameters         ||
|--------------|--------------|
| `categories` | `Set` <br /> |

|                                                                   Returns                                                                   ||
|---------------------------------------------------------------------------------------------------------|------------------------------------|
| [ShortcutInfo.Builder](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder) | This value cannot be`null`. <br /> |

**See also:**

- [ShortcutInfo.SHORTCUT_CATEGORY_CONVERSATION](https://developer.android.com/reference/android/content/pm/ShortcutInfo#SHORTCUT_CATEGORY_CONVERSATION)
- [ShortcutInfo.getCategories()](https://developer.android.com/reference/android/content/pm/ShortcutInfo#getCategories())  

### setDisabledMessage

Added in[API level 25](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public ShortcutInfo.Builder setDisabledMessage (CharSequence disabledMessage)
```

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

<br />

|                              Parameters                               ||
|-------------------|----------------------------------------------------|
| `disabledMessage` | `CharSequence`: This value cannot be`null`. <br /> |

|                                                                   Returns                                                                   ||
|---------------------------------------------------------------------------------------------------------|------------------------------------|
| [ShortcutInfo.Builder](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder) | This value cannot be`null`. <br /> |

**See also:**

- [ShortcutInfo.getDisabledMessage()](https://developer.android.com/reference/android/content/pm/ShortcutInfo#getDisabledMessage())  

### setExcludedFromSurfaces

Added in[API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public ShortcutInfo.Builder setExcludedFromSurfaces (int surfaces)
```

Sets which surfaces a shortcut will be excluded from. This API is reserved for future extension. Currently, marking a shortcut to be excluded from[ShortcutInfo.SURFACE_LAUNCHER](https://developer.android.com/reference/android/content/pm/ShortcutInfo#SURFACE_LAUNCHER)will not publish the shortcut, thus the following operations will be a no-op:[ShortcutManager.pushDynamicShortcut(android.content.pm.ShortcutInfo)](https://developer.android.com/reference/android/content/pm/ShortcutManager#pushDynamicShortcut(android.content.pm.ShortcutInfo)),[ShortcutManager.addDynamicShortcuts(List)](https://developer.android.com/reference/android/content/pm/ShortcutManager#addDynamicShortcuts(java.util.List<android.content.pm.ShortcutInfo>)), and[ShortcutManager.setDynamicShortcuts(List)](https://developer.android.com/reference/android/content/pm/ShortcutManager#setDynamicShortcuts(java.util.List<android.content.pm.ShortcutInfo>)).

<br />

|        Parameters        ||
|------------|--------------|
| `surfaces` | `int` <br /> |

|                                                                   Returns                                                                   ||
|---------------------------------------------------------------------------------------------------------|------------------------------------|
| [ShortcutInfo.Builder](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder) | This value cannot be`null`. <br /> |

### setExtras

Added in[API level 25](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public ShortcutInfo.Builder setExtras (PersistableBundle extras)
```

Extras that the app can set for any purpose.

Apps can store arbitrary shortcut metadata in extras and retrieve the metadata later using[ShortcutInfo.getExtras()](https://developer.android.com/reference/android/content/pm/ShortcutInfo#getExtras()).

<br />

|                            Parameters                             ||
|----------|---------------------------------------------------------|
| `extras` | `PersistableBundle`: This value cannot be`null`. <br /> |

|                                                                   Returns                                                                   ||
|---------------------------------------------------------------------------------------------------------|------------------------------------|
| [ShortcutInfo.Builder](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder) | This value cannot be`null`. <br /> |

### setIcon

Added in[API level 25](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public ShortcutInfo.Builder setIcon (Icon icon)
```

Sets an icon of a shortcut.

Icons are not available on[ShortcutInfo](https://developer.android.com/reference/android/content/pm/ShortcutInfo)instances returned by[ShortcutManager](https://developer.android.com/reference/android/content/pm/ShortcutManager)or[LauncherApps](https://developer.android.com/reference/android/content/pm/LauncherApps). The default launcher app can use[LauncherApps.getShortcutIconDrawable(ShortcutInfo, int)](https://developer.android.com/reference/android/content/pm/LauncherApps#getShortcutIconDrawable(android.content.pm.ShortcutInfo,%20int))or[LauncherApps.getShortcutBadgedIconDrawable(ShortcutInfo, int)](https://developer.android.com/reference/android/content/pm/LauncherApps#getShortcutBadgedIconDrawable(android.content.pm.ShortcutInfo,%20int))to fetch shortcut icons.

Tints set with[Icon.setTint](https://developer.android.com/reference/android/graphics/drawable/Icon#setTint(int))or[Icon.setTintList](https://developer.android.com/reference/android/graphics/drawable/Icon#setTintList(android.content.res.ColorStateList))are not supported and will be ignored.

Only icons created with[Icon.createWithBitmap(Bitmap)](https://developer.android.com/reference/android/graphics/drawable/Icon#createWithBitmap(android.graphics.Bitmap)),[Icon.createWithAdaptiveBitmap(Bitmap)](https://developer.android.com/reference/android/graphics/drawable/Icon#createWithAdaptiveBitmap(android.graphics.Bitmap))and[Icon.createWithResource](https://developer.android.com/reference/android/graphics/drawable/Icon#createWithResource(android.content.Context,%20int))are supported. Other types, such as URI-based icons, are not supported.

<br />

|      Parameters       ||
|--------|---------------|
| `icon` | `Icon` <br /> |

|                                                                   Returns                                                                   ||
|---------------------------------------------------------------------------------------------------------|------------------------------------|
| [ShortcutInfo.Builder](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder) | This value cannot be`null`. <br /> |

**See also:**

- [LauncherApps.getShortcutIconDrawable(ShortcutInfo, int)](https://developer.android.com/reference/android/content/pm/LauncherApps#getShortcutIconDrawable(android.content.pm.ShortcutInfo,%20int))
- [LauncherApps.getShortcutBadgedIconDrawable(ShortcutInfo, int)](https://developer.android.com/reference/android/content/pm/LauncherApps#getShortcutBadgedIconDrawable(android.content.pm.ShortcutInfo,%20int))  

### setIntent

Added in[API level 25](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public ShortcutInfo.Builder setIntent (Intent intent)
```

Sets the intent of a shortcut. Alternatively,[setIntents(android.content.Intent[])](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder#setIntents(android.content.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 with[ShortcutManager.addDynamicShortcuts(List)](https://developer.android.com/reference/android/content/pm/ShortcutManager#addDynamicShortcuts(java.util.List<android.content.pm.ShortcutInfo>))or[ShortcutManager.setDynamicShortcuts(List)](https://developer.android.com/reference/android/content/pm/ShortcutManager#setDynamicShortcuts(java.util.List<android.content.pm.ShortcutInfo>)).

A shortcut can launch any intent that the publisher app has permission to launch. For example, a shortcut can launch an unexported activity within the publisher app. A shortcut intent doesn't have to point at the target activity.

The given`intent`can contain extras, but these extras must contain values of primitive types in order for the system to persist these values.

<br />

|                       Parameters                       ||
|----------|----------------------------------------------|
| `intent` | `Intent`: This value cannot be`null`. <br /> |

|                                                                   Returns                                                                   ||
|---------------------------------------------------------------------------------------------------------|------------------------------------|
| [ShortcutInfo.Builder](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder) | This value cannot be`null`. <br /> |

**See also:**

- [ShortcutInfo.getIntent()](https://developer.android.com/reference/android/content/pm/ShortcutInfo#getIntent())
- [setIntents(Intent[])](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder#setIntents(android.content.Intent[]))  

### setIntents

Added in[API level 25](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public ShortcutInfo.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](https://developer.android.com/reference/android/app/TaskStackBuilder)to build intents. The last element in the list represents the only intent that doesn't place an activity on the back stack. See the[ShortcutManager](https://developer.android.com/reference/android/content/pm/ShortcutManager)javadoc for details.

<br />

|                       Parameters                        ||
|-----------|----------------------------------------------|
| `intents` | `Intent`: This value cannot be`null`. <br /> |

|                                                                   Returns                                                                   ||
|---------------------------------------------------------------------------------------------------------|------------------------------------|
| [ShortcutInfo.Builder](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder) | This value cannot be`null`. <br /> |

**See also:**

- [setIntent(Intent)](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder#setIntent(android.content.Intent))
- [ShortcutInfo.getIntents()](https://developer.android.com/reference/android/content/pm/ShortcutInfo#getIntents())
- [Context.startActivities(Intent[])](https://developer.android.com/reference/android/content/Context#startActivities(android.content.Intent[]))
- [TaskStackBuilder](https://developer.android.com/reference/android/app/TaskStackBuilder)  

### setLocusId

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public ShortcutInfo.Builder setLocusId (LocusId locusId)
```

Sets the[LocusId](https://developer.android.com/reference/android/content/LocusId)associated with this shortcut.

This method should be called when the[LocusId](https://developer.android.com/reference/android/content/LocusId)is used in other places (such as[Notification](https://developer.android.com/reference/android/app/Notification)and[ContentCaptureContext](https://developer.android.com/reference/android/view/contentcapture/ContentCaptureContext)) so the device's intelligence services can correlate them.

<br />

|                        Parameters                        ||
|-----------|-----------------------------------------------|
| `locusId` | `LocusId`: This value cannot be`null`. <br /> |

|                                                                   Returns                                                                   ||
|---------------------------------------------------------------------------------------------------------|------------------------------------|
| [ShortcutInfo.Builder](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder) | This value cannot be`null`. <br /> |

### setLongLabel

Added in[API level 25](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public ShortcutInfo.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.

<br />

|                           Parameters                            ||
|-------------|----------------------------------------------------|
| `longLabel` | `CharSequence`: This value cannot be`null`. <br /> |

|                                                                   Returns                                                                   ||
|---------------------------------------------------------------------------------------------------------|------------------------------------|
| [ShortcutInfo.Builder](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder) | This value cannot be`null`. <br /> |

**See also:**

- [ShortcutInfo.getLongLabel()](https://developer.android.com/reference/android/content/pm/ShortcutInfo#getLongLabel())  

### setLongLived

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public ShortcutInfo.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). If it is long lived, it can be cached by various system services even after it has been unpublished as a dynamic shortcut.

<br />

|          Parameters           ||
|-------------|------------------|
| `longLived` | `boolean` <br /> |

|                                                                   Returns                                                                   ||
|---------------------------------------------------------------------------------------------------------|------------------------------------|
| [ShortcutInfo.Builder](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder) | This value cannot be`null`. <br /> |

### setPerson

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public ShortcutInfo.Builder setPerson (Person person)
```

Add a person that is relevant to this shortcut. Alternatively,[setPersons(android.app.Person[])](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder#setPersons(android.app.Person[]))can be used to add multiple persons to a shortcut.

This is an optional field, but the addition of person may cause this shortcut to appear more prominently in the user interface (e.g. ShareSheet).

A person should usually contain a uri in order to benefit from the ranking boost. However, even if no uri is provided, it's beneficial to provide people in the shortcut, such that listeners and voice only devices can announce and handle them properly.

<br />

|                       Parameters                       ||
|----------|----------------------------------------------|
| `person` | `Person`: This value cannot be`null`. <br /> |

|                                                                   Returns                                                                   ||
|---------------------------------------------------------------------------------------------------------|------------------------------------|
| [ShortcutInfo.Builder](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder) | This value cannot be`null`. <br /> |

**See also:**

- [Person](https://developer.android.com/reference/android/app/Person)
- [setPersons(Person[])](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder#setPersons(android.app.Person[]))  

### setPersons

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public ShortcutInfo.Builder setPersons (Person[] persons)
```

Sets multiple persons instead of a single person.

<br />

|                       Parameters                        ||
|-----------|----------------------------------------------|
| `persons` | `Person`: This value cannot be`null`. <br /> |

|                                                                   Returns                                                                   ||
|---------------------------------------------------------------------------------------------------------|------------------------------------|
| [ShortcutInfo.Builder](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder) | This value cannot be`null`. <br /> |

**See also:**

- [Person](https://developer.android.com/reference/android/app/Person)
- [setPerson(Person)](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder#setPerson(android.app.Person))  

### setRank

Added in[API level 25](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public ShortcutInfo.Builder setRank (int rank)
```

"Rank" of a shortcut, which is a non-negative value that's used by the launcher app to sort shortcuts. See[ShortcutInfo.getRank()](https://developer.android.com/reference/android/content/pm/ShortcutInfo#getRank())for details.

<br />

|      Parameters      ||
|--------|--------------|
| `rank` | `int` <br /> |

|                                                                   Returns                                                                   ||
|---------------------------------------------------------------------------------------------------------|------------------------------------|
| [ShortcutInfo.Builder](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder) | This value cannot be`null`. <br /> |

### setShortLabel

Added in[API level 25](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public ShortcutInfo.Builder setShortLabel (CharSequence shortLabel)
```

Sets the short title of a shortcut.

This is a mandatory field when publishing a new shortcut with[ShortcutManager.addDynamicShortcuts(List)](https://developer.android.com/reference/android/content/pm/ShortcutManager#addDynamicShortcuts(java.util.List<android.content.pm.ShortcutInfo>))or[ShortcutManager.setDynamicShortcuts(List)](https://developer.android.com/reference/android/content/pm/ShortcutManager#setDynamicShortcuts(java.util.List<android.content.pm.ShortcutInfo>)).

This field is intended to be a concise description of a shortcut.

The recommended maximum length is 10 characters.

<br />

|                            Parameters                            ||
|--------------|----------------------------------------------------|
| `shortLabel` | `CharSequence`: This value cannot be`null`. <br /> |

|                                                                   Returns                                                                   ||
|---------------------------------------------------------------------------------------------------------|------------------------------------|
| [ShortcutInfo.Builder](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder) | This value cannot be`null`. <br /> |

**See also:**

- [ShortcutInfo.getShortLabel()](https://developer.android.com/reference/android/content/pm/ShortcutInfo#getShortLabel())  

### setStartingTheme

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public ShortcutInfo.Builder setStartingTheme (int themeResId)
```

Sets a theme resource id for the splash screen.

<br />

|         Parameters         ||
|--------------|--------------|
| `themeResId` | `int` <br /> |

|                                                                   Returns                                                                   ||
|---------------------------------------------------------------------------------------------------------|------------------------------------|
| [ShortcutInfo.Builder](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder) | This value cannot be`null`. <br /> |