The Android Developer Challenge is back! Submit your idea before December 2.

RemoteActionCompat

public final class RemoteActionCompat
extends Object implements VersionedParcelable

java.lang.Object
   ↳ androidx.core.app.RemoteActionCompat


Represents a remote action that can be called from another process. The action can have an associated visualization including metadata like an icon or title.

This is a backward-compatible version of RemoteAction.

Summary

Public constructors

RemoteActionCompat(IconCompat icon, CharSequence title, CharSequence contentDescription, PendingIntent intent)
RemoteActionCompat(RemoteActionCompat other)

Constructs a RemoteActionCompat using data from other.

Public methods

static RemoteActionCompat createFromRemoteAction(RemoteAction remoteAction)

Creates an RemoteActionCompat from a RemoteAction.

PendingIntent getActionIntent()

Return the action intent.

CharSequence getContentDescription()

Return a content description representing the action.

IconCompat getIcon()

Return an icon representing the action.

CharSequence getTitle()

Return an title representing the action.

boolean isEnabled()

Return whether this action is enabled.

void setEnabled(boolean enabled)

Sets whether this action is enabled.

void setShouldShowIcon(boolean shouldShowIcon)

Sets whether the icon should be shown.

boolean shouldShowIcon()

Return whether the icon should be shown.

RemoteAction toRemoteAction()

Convert this compat object to RemoteAction object.

Inherited methods

Public constructors

RemoteActionCompat

public RemoteActionCompat (IconCompat icon, 
                CharSequence title, 
                CharSequence contentDescription, 
                PendingIntent intent)

Parameters
icon IconCompat

title CharSequence

contentDescription CharSequence

intent PendingIntent

RemoteActionCompat

public RemoteActionCompat (RemoteActionCompat other)

Constructs a RemoteActionCompat using data from other.

Parameters
other RemoteActionCompat

Public methods

createFromRemoteAction

public static RemoteActionCompat createFromRemoteAction (RemoteAction remoteAction)

Creates an RemoteActionCompat from a RemoteAction.

Parameters
remoteAction RemoteAction

Returns
RemoteActionCompat

getActionIntent

public PendingIntent getActionIntent ()

Return the action intent.

Returns
PendingIntent

getContentDescription

public CharSequence getContentDescription ()

Return a content description representing the action.

Returns
CharSequence

getIcon

public IconCompat getIcon ()

Return an icon representing the action.

Returns
IconCompat

getTitle

public CharSequence getTitle ()

Return an title representing the action.

Returns
CharSequence

isEnabled

public boolean isEnabled ()

Return whether this action is enabled.

Returns
boolean

setEnabled

public void setEnabled (boolean enabled)

Sets whether this action is enabled.

Parameters
enabled boolean

setShouldShowIcon

public void setShouldShowIcon (boolean shouldShowIcon)

Sets whether the icon should be shown.

Parameters
shouldShowIcon boolean

shouldShowIcon

public boolean shouldShowIcon ()

Return whether the icon should be shown.

Returns
boolean

toRemoteAction

public RemoteAction toRemoteAction ()

Convert this compat object to RemoteAction object.

Returns
RemoteAction RemoteAction object