Android APIs
public static class

Notification.Action

extends Object
implements Parcelable
java.lang.Object
   ↳ android.app.Notification.Action

Class Overview

Structure to encapsulate a named action that can be shown as part of this notification. It must include an icon, a label, and a PendingIntent to be fired when the action is selected by the user.

Apps should use addAction(int, CharSequence, PendingIntent) or addAction(Notification.Action) to attach actions.

Summary

Nested Classes
class Notification.Action.Builder Builder class for Notification.Action objects. 
interface Notification.Action.Extender Extender interface for use with extend(Notification.Action.Extender)
class Notification.Action.WearableExtender Wearable extender for notification actions. 
[Expand]
Inherited Constants
From interface android.os.Parcelable
Fields
public static final Creator<Notification.Action> CREATOR
public PendingIntent actionIntent Intent to send when the user invokes this action.
public int icon This field was deprecated in API level 23. Use getIcon() instead.
public CharSequence title Title of the action.
Public Constructors
Notification.Action(int icon, CharSequence title, PendingIntent intent)
This constructor was deprecated in API level 23. Use Notification.Action.Builder.
Public Methods
Notification.Action clone()
Creates and returns a copy of this Object.
int describeContents()
Describe the kinds of special objects contained in this Parcelable's marshalled representation.
Bundle getExtras()
Get additional metadata carried around with this Action.
Icon getIcon()
Return an icon representing the action.
RemoteInput[] getRemoteInputs()
Get the list of inputs to be collected from the user when this action is sent.
void writeToParcel(Parcel out, int flags)
Flatten this object in to a Parcel.
[Expand]
Inherited Methods
From class java.lang.Object
From interface android.os.Parcelable

Fields

public static final Creator<Notification.Action> CREATOR

Added in API level 19

public PendingIntent actionIntent

Added in API level 19

Intent to send when the user invokes this action. May be null, in which case the action may be rendered in a disabled presentation by the system UI.

public int icon

Added in API level 19

This field was deprecated in API level 23.
Use getIcon() instead.

Small icon representing the action.

public CharSequence title

Added in API level 19

Title of the action.

Public Constructors

public Notification.Action (int icon, CharSequence title, PendingIntent intent)

Added in API level 19

This constructor was deprecated in API level 23.
Use Notification.Action.Builder.

Parameters
icon int
title CharSequence
intent PendingIntent

Public Methods

public Notification.Action clone ()

Added in API level 19

Creates and returns a copy of this Object. The default implementation returns a so-called "shallow" copy: It creates a new instance of the same class and then copies the field values (including object references) from this instance to the new instance. A "deep" copy, in contrast, would also recursively clone nested objects. A subclass that needs to implement this kind of cloning should call super.clone() to create the new instance and then create deep copies of the nested, mutable objects.

Returns
Notification.Action a copy of this object.

public int describeContents ()

Added in API level 19

Describe the kinds of special objects contained in this Parcelable's marshalled representation.

Returns
int a bitmask indicating the set of special object types marshalled by the Parcelable.

public Bundle getExtras ()

Added in API level 20

Get additional metadata carried around with this Action.

Returns
Bundle

public Icon getIcon ()

Added in API level 23

Return an icon representing the action.

Returns
Icon

public RemoteInput[] getRemoteInputs ()

Added in API level 20

Get the list of inputs to be collected from the user when this action is sent. May return null if no remote inputs were added.

Returns
RemoteInput[]

public void writeToParcel (Parcel out, int flags)

Added in API level 19

Flatten this object in to a Parcel.

Parameters
out Parcel: The Parcel in which the object should be written.
flags int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE.