Google is committed to advancing racial equity for Black communities. See how.

SliceAction

@RequiresApi(19) open class SliceAction : SliceAction
kotlin.Any
   ↳ androidx.slice.builders.SliceAction

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

Summary

Public methods
open static SliceAction!
create(@NonNull action: PendingIntent, @NonNull actionIcon: IconCompat, imageMode: Int, @NonNull actionTitle: CharSequence)

Construct a SliceAction representing a tappable icon.

open static SliceAction!
create(@NonNull action: RemoteCallback, @NonNull actionIcon: IconCompat, imageMode: Int, @NonNull actionTitle: CharSequence)

Construct a SliceAction representing a tappable icon.

open static SliceAction!
createDeeplink(@NonNull action: PendingIntent, @NonNull actionIcon: IconCompat, imageMode: Int, @NonNull actionTitle: CharSequence)

Construct a SliceAction representing a tappable icon that launches an activity when clicked.

open static SliceAction!
createDeeplink(@NonNull action: RemoteCallback, @NonNull actionIcon: IconCompat, imageMode: Int, @NonNull actionTitle: CharSequence)

Construct a SliceAction representing a tappable icon that launches an activity when clicked.

open static SliceAction!
createToggle(@NonNull action: PendingIntent, @NonNull actionTitle: CharSequence, isChecked: Boolean)

Construct a SliceAction representing a default toggle.

open static SliceAction!
createToggle(@NonNull action: RemoteCallback, @NonNull actionTitle: CharSequence, isChecked: Boolean)

Construct a SliceAction representing a default toggle.

open static SliceAction!
createToggle(@NonNull action: PendingIntent, @NonNull actionIcon: IconCompat, @NonNull actionTitle: CharSequence, isChecked: Boolean)

Construct a SliceAction representing a custom toggle icon.

open static SliceAction!
createToggle(@NonNull action: RemoteCallback, @NonNull actionIcon: IconCompat, @NonNull actionTitle: CharSequence, isChecked: Boolean)

Construct a SliceAction representing a custom toggle icon.

open PendingIntent

open CharSequence?

open IconCompat?

open Int

open Int

open CharSequence

open Boolean

open Boolean

open Boolean

open Boolean

open SliceAction
setChecked(isChecked: Boolean)

open SliceAction
setContentDescription(@NonNull description: CharSequence)

open SliceAction
setPriority(@IntRange(0) priority: Int)

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

Public methods

create

open static fun create(
    @NonNull action: PendingIntent,
    @NonNull actionIcon: IconCompat,
    imageMode: Int,
    @NonNull actionTitle: CharSequence
): SliceAction!

Construct a SliceAction representing a tappable icon.

Parameters
action PendingIntent: the pending intent to invoke for this action.
actionIcon IconCompat: the icon to display for this action.
imageMode Int: the mode this icon should be displayed in.
actionTitle CharSequence: the title for this action, also used for content description if one hasn't been set via setContentDescription(CharSequence).

create

open static fun create(
    @NonNull action: RemoteCallback,
    @NonNull actionIcon: IconCompat,
    imageMode: Int,
    @NonNull actionTitle: CharSequence
): SliceAction!

Construct a SliceAction representing a tappable icon.

Parameters
action RemoteCallback: the remote callback to invoke for this action.
actionIcon IconCompat: the icon to display for this action.
imageMode Int: the mode this icon should be displayed in.
actionTitle CharSequence: the title for this action, also used for content description if one hasn't been set via setContentDescription(CharSequence).
open static fun createDeeplink(
    @NonNull action: PendingIntent,
    @NonNull actionIcon: IconCompat,
    imageMode: Int,
    @NonNull actionTitle: CharSequence
): SliceAction!

Construct a SliceAction representing a tappable icon that launches an activity when clicked.

Parameters
action PendingIntent: the pending intent to invoke for this action.
actionIcon IconCompat: the icon to display for this action.
imageMode Int: the mode this icon should be displayed in.
actionTitle CharSequence: the title for this action, also used for content description if one hasn't been set via setContentDescription(CharSequence).
open static fun createDeeplink(
    @NonNull action: RemoteCallback,
    @NonNull actionIcon: IconCompat,
    imageMode: Int,
    @NonNull actionTitle: CharSequence
): SliceAction!

Construct a SliceAction representing a tappable icon that launches an activity when clicked.

Parameters
action RemoteCallback: the remote callback to invoke for this action.
actionIcon IconCompat: the icon to display for this action.