Save the date! Android Dev Summit is coming to Sunnyvale, CA on Oct 23-24, 2019.

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 IconCompat?

abstract Boolean

abstract SliceAction?
setContentDescription(@NonNull description: CharSequence)

abstract CharSequence?

abstract Boolean

abstract Boolean

abstract Boolean

abstract Int

abstract SliceAction!
setChecked(isChecked: Boolean)

abstract PendingIntent

abstract CharSequence

abstract Int

abstract SliceAction!
setPriority(priority: Int)

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

Public methods

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.

isActivity

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

setContentDescription

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

getContentDescription

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

isToggle

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

isDefaultToggle

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

isChecked

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

getPriority

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

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.

getAction

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

getTitle

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

getImageMode

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

setPriority

abstract fun setPriority(priority: Int): SliceAction!

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