Action

open class Action
kotlin.Any
   ↳ androidx.leanback.widget.Action

An action contains one or two lines of text, an optional image and an optional id. It may also be invoked by one or more keycodes.

Summary

Constants
static Long

Indicates that an id has not been set.

Public constructors
<init>(id: Long)

Constructor for an Action.

<init>(id: Long, label: CharSequence!)

Constructor for an Action.

<init>(id: Long, label1: CharSequence!, label2: CharSequence!)

Constructor for an Action.

<init>(id: Long, label1: CharSequence!, label2: CharSequence!, icon: Drawable!)

Constructor for an Action.

Public methods
Unit
setId(id: Long)

Sets the id for this Action.

Drawable!

Returns the icon drawable for this Action.

CharSequence!

Returns the second line label for this Action.

Boolean

Returns true if the Action should respond to the given keycode.

CharSequence!

Returns the first line label for this Action.

open String

Long

Returns the id for this Action.

Unit
setIcon(icon: Drawable!)

Sets the icon drawable for this Action.

Unit
addKeyCode(keyCode: Int)

Adds a keycode used to invoke this Action.

Unit
removeKeyCode(keyCode: Int)

Removes a keycode used to invoke this Action.

Unit

Sets the second line label for this Action.

Unit

Sets the first line label for this Action.

Constants

NO_ID

static val NO_ID: Long

Indicates that an id has not been set.

Value: -1L

Public constructors

<init>

Action(id: Long)

Constructor for an Action.

Parameters
id Long: The id of the Action.

<init>

Action(id: Long, label: CharSequence!)

Constructor for an Action.

Parameters
id Long: The id of the Action.
label Long: The label to display for the Action.

<init>

Action(id: Long, label1: CharSequence!, label2: CharSequence!)

Constructor for an Action.

Parameters
id Long: The id of the Action.
label1 Long: The label to display on the first line of the Action.
label2 Long: The label to display on the second line of the Action.

<init>

Action(id: Long, label1: CharSequence!, label2: CharSequence!, icon: Drawable!)

Constructor for an Action.

Parameters
id Long: The id of the Action.
label1 Long: The label to display on the first line of the Action.
label2 Long: The label to display on the second line of the Action.
icon Long: The icon to display for the Action.

Public methods

setId

fun setId(id: Long): Unit

Sets the id for this Action.

getIcon

fun getIcon(): Drawable!

Returns the icon drawable for this Action.

getLabel2

fun getLabel2(): CharSequence!

Returns the second line label for this Action.

respondsToKeyCode

fun respondsToKeyCode(keyCode: Int): Boolean

Returns true if the Action should respond to the given keycode.

getLabel1

fun getLabel1(): CharSequence!

Returns the first line label for this Action.

toString

open fun toString(): String

getId

fun getId(): Long

Returns the id for this Action.

setIcon

fun setIcon(icon: Drawable!): Unit

Sets the icon drawable for this Action.

addKeyCode

fun addKeyCode(keyCode: Int): Unit

Adds a keycode used to invoke this Action.

removeKeyCode

fun removeKeyCode(keyCode: Int): Unit

Removes a keycode used to invoke this Action.

setLabel2

fun setLabel2(label: CharSequence!): Unit

Sets the second line label for this Action.

setLabel1

fun setLabel1(label: CharSequence!): Unit

Sets the first line label for this Action.