Save the date! Android Dev Summit is coming to Mountain View, CA on November 7-8, 2018.
added in version 1.0.0
belongs to Maven artifact androidx.slice:slice-core:1.1.0-alpha01

SliceAction

public interface SliceAction

androidx.slice.core.SliceAction


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

Summary

Public methods

abstract PendingIntent getAction()
abstract CharSequence getContentDescription()
abstract IconCompat getIcon()
abstract int getImageMode()
abstract int getPriority()
abstract CharSequence getTitle()
abstract boolean isActivity()
abstract boolean isChecked()
abstract boolean isDefaultToggle()
abstract boolean isToggle()
abstract SliceAction setChecked(boolean isChecked)
abstract SliceAction setContentDescription(CharSequence description)
abstract SliceAction setPriority(int priority)

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

Public methods

getAction

added in version 1.0.0
public abstract PendingIntent getAction ()

Returns
PendingIntent the PendingIntent associated with this action.

getContentDescription

added in version 1.0.0
public abstract CharSequence getContentDescription ()

Returns
CharSequence the content description to use for this action.

getIcon

added in version 1.0.0
public abstract IconCompat getIcon ()

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

getImageMode

added in version 1.0.0
public abstract int getImageMode ()

Returns
int the image mode to use for this action.

getPriority

added in version 1.0.0
public abstract int getPriority ()

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

getTitle

added in version 1.0.0
public abstract CharSequence getTitle ()

Returns
CharSequence the title for this action.

isActivity

added in version 1.0.0
public abstract boolean isActivity ()

Returns
boolean whether this activity launches an activity or not.

isChecked

added in version 1.0.0
public abstract boolean isChecked ()

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

isDefaultToggle

added in version 1.0.0
public abstract boolean isDefaultToggle ()

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

isToggle

added in version 1.0.0
public abstract boolean isToggle ()

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

setChecked

added in version 1.0.0
public abstract SliceAction setChecked (boolean isChecked)

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

Returns
SliceAction

setContentDescription

added in version 1.0.0
public abstract SliceAction setContentDescription (CharSequence description)

Parameters
description CharSequence: the content description for this action.

Returns
SliceAction

setPriority

added in version 1.0.0
public abstract SliceAction setPriority (int priority)

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

Parameters
priority int

Returns
SliceAction