Stay organized with collections Save and categorize content based on your preferences.

SliceAction

@RequiresApi(value = 19)
public interface SliceAction

Known direct subclasses
SliceAction

Class representing an action, supports tappable icons, custom toggle icons, and default toggles, as well as date and time pickers.


Interface for a slice action, supports tappable icons, custom toggle icons, and default toggles.

Summary

Public methods

abstract @NonNull PendingIntent
abstract @Nullable CharSequence
abstract @Nullable IconCompat
abstract int
abstract int
abstract @NonNull CharSequence
abstract boolean
abstract boolean
abstract boolean
abstract boolean
abstract SliceAction
setChecked(boolean isChecked)
abstract @Nullable SliceAction
abstract SliceAction
setPriority(@IntRange(from = 0) int priority)

Sets the priority of this action, with the lowest priority having the highest ranking.

Public methods

getAction

abstract @NonNull PendingIntent getAction()
Returns
@NonNull PendingIntent

the PendingIntent associated with this action.

getContentDescription

abstract @Nullable CharSequence getContentDescription()
Returns
@Nullable CharSequence

the content description to use for this action.

getIcon

abstract @Nullable IconCompat getIcon()
Returns
@Nullable IconCompat

the IconCompat to display for this action. This can be null when the action represented is a default toggle.

getImageMode

abstract int getImageMode()
Returns
int

the image mode to use for this action.

getPriority

abstract int getPriority()
Returns
int

the priority associated with this action, -1 if unset.

getTitle

abstract @NonNull CharSequence getTitle()
Returns
@NonNull CharSequence

the title for this action.

isActivity

abstract boolean isActivity()
Returns
boolean

whether this activity launches an activity or not.

isChecked

abstract boolean isChecked()
Returns
boolean

whether the state of this action is checked or not; only used for toggle actions.

isDefaultToggle

abstract boolean isDefaultToggle()
Returns
boolean

whether this action is a toggle using the standard switch control.

isToggle

abstract boolean isToggle()
Returns
boolean

whether this action represents a toggle (i.e. has a checked and unchecked state).

setChecked

abstract SliceAction setChecked(boolean isChecked)
Parameters
boolean isChecked

whether the state of this action is checked or not; only used for toggle actions.

setContentDescription

abstract @Nullable SliceAction setContentDescription(@NonNull CharSequence description)
Parameters
@NonNull CharSequence description

the content description for this action.

setPriority

abstract SliceAction setPriority(@IntRange(from = 0) int priority)

Sets the priority of this action, with the lowest priority having the highest ranking.