Android Dev Summit, October 23-24: two days of technical content, directly from the Android team. Sign-up for livestream updates.

SliceAction

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

abstract CharSequence?

abstract IconCompat?

abstract Int

abstract Int

abstract CharSequence

abstract Boolean

abstract Boolean

abstract Boolean

abstract Boolean

abstract SliceAction!
setChecked(isChecked: Boolean)

abstract SliceAction?
setContentDescription(@NonNull description: CharSequence)

abstract SliceAction!
setPriority(priority: Int)

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

Public methods

getAction

@NonNull abstract fun getAction(): PendingIntent
Return
PendingIntent: the PendingIntent associated with this action.

getContentDescription

@Nullable abstract fun getContentDescription(): CharSequence?
Return
CharSequence?: the content description to use for this action.

getIcon

@Nullable abstract fun getIcon(): IconCompat?
Return
IconCompat?: the IconCompat to display for this action. This can be null when the action represented is a default toggle.

getImageMode

abstract fun getImageMode(): Int
Return
Int: the image mode to use for this action.

getPriority

abstract fun getPriority(): Int
Return
Int: the priority associated with this action, -1 if unset.

getTitle

@NonNull abstract fun getTitle(): CharSequence
Return
CharSequence: the title for this action.

isActivity

abstract fun isActivity(): Boolean
Return
Boolean: whether this activity launches an activity or not.

isChecked

abstract fun isChecked(): Boolean
Return
Boolean: whether the state of this action is checked or not; only used for toggle actions.

isDefaultToggle

abstract fun isDefaultToggle(): Boolean
Return
Boolean: whether this action is a toggle using the standard switch control.

isToggle

abstract fun isToggle(): Boolean
Return
Boolean: whether this action represents a toggle (i.e. has a checked and unchecked state).

setChecked

abstract fun setChecked(isChecked: Boolean): SliceAction!
Parameters
isChecked Boolean: whether the state of this action is checked or not; only used for toggle actions.

setContentDescription

@Nullable abstract fun setContentDescription(@NonNull description: CharSequence): SliceAction?
Parameters
description CharSequence: the content description for this action.

setPriority

abstract fun setPriority(priority: Int): SliceAction!

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