NotificationCompat.Action.Builder

public static final class NotificationCompat.Action.Builder
extends Object

java.lang.Object
   ↳ androidx.core.app.NotificationCompat.Action.Builder


Builder class for NotificationCompat.Action objects.

Summary

Public constructors

Builder(IconCompat icon, CharSequence title, PendingIntent intent)

Construct a new builder for NotificationCompat.Action object.

Builder(int icon, CharSequence title, PendingIntent intent)

Construct a new builder for NotificationCompat.Action object.

Builder(NotificationCompat.Action action)

Construct a new builder for NotificationCompat.Action object using the fields from an NotificationCompat.Action.

Public methods

NotificationCompat.Action.Builder addExtras(Bundle extras)

Merge additional metadata into this builder.

NotificationCompat.Action.Builder addRemoteInput(RemoteInput remoteInput)

Add an input to be collected from the user when this action is sent.

NotificationCompat.Action build()

Combine all of the options that have been set and return a new NotificationCompat.Action object.

NotificationCompat.Action.Builder extend(NotificationCompat.Action.Extender extender)

Apply an extender to this action builder.

Bundle getExtras()

Get the metadata Bundle used by this Builder.

NotificationCompat.Action.Builder setAllowGeneratedReplies(boolean allowGeneratedReplies)

Set whether the platform should automatically generate possible replies to add to RemoteInput.getChoices().

NotificationCompat.Action.Builder setContextual(boolean isContextual)

Sets whether this NotificationCompat.Action is a contextual action, i.e.

NotificationCompat.Action.Builder setSemanticAction(int semanticAction)

Sets the NotificationCompat.Action.SemanticAction for this NotificationCompat.Action.

NotificationCompat.Action.Builder setShowsUserInterface(boolean showsUserInterface)

Set whether or not this NotificationCompat.Action's PendingIntent will open a user interface.

Inherited methods

Public constructors

Builder

public Builder (IconCompat icon, 
                CharSequence title, 
                PendingIntent intent)

Construct a new builder for NotificationCompat.Action object.

Note: For devices running an Android version strictly lower than API level 23 this constructor only supports resource-ID based IconCompat objects.

Parameters
icon IconCompat: icon to show for this action

title CharSequence: the title of the action

intent PendingIntent: the PendingIntent to fire when users trigger this action

Builder

public Builder (int icon, 
                CharSequence title, 
                PendingIntent intent)

Construct a new builder for NotificationCompat.Action object.

Parameters
icon int: icon to show for this action

title CharSequence: the title of the action

intent PendingIntent: the PendingIntent to fire when users trigger this action

Builder

public Builder (NotificationCompat.Action action)

Construct a new builder for NotificationCompat.Action object using the fields from an NotificationCompat.Action.

Parameters
action NotificationCompat.Action: the action to read fields from.

Public methods

addExtras

public NotificationCompat.Action.Builder addExtras (Bundle extras)

Merge additional metadata into this builder.

Values within the Bundle will replace existing extras values in this Builder.

Parameters
extras Bundle

Returns
NotificationCompat.Action.Builder

addRemoteInput

public NotificationCompat.Action.Builder addRemoteInput (RemoteInput remoteInput)

Add an input to be collected from the user when this action is sent. Response values can be retrieved from the fired intent by using the RemoteInput.getResultsFromIntent(Intent) function.

Parameters
remoteInput RemoteInput: a RemoteInput to add to the action

Returns
NotificationCompat.Action.Builder this object for method chaining

build