Added in API level 30

ToggleTemplate


class ToggleTemplate : ControlTemplate
kotlin.Any
   ↳ android.service.controls.templates.ControlTemplate
   ↳ android.service.controls.templates.ToggleTemplate

A template for a Control with a single button that can be toggled between two states. The states for the toggle correspond to the states in ControlButton.isChecked(). An action on this template will originate a BooleanAction to change that state.

Summary

Inherited constants
Public constructors
ToggleTemplate(templateId: String, button: ControlButton)

Public methods
CharSequence

Int

Boolean

Inherited functions

Public constructors

ToggleTemplate

Added in API level 30
ToggleTemplate(
    templateId: String,
    button: ControlButton)
Parameters
templateId String: the identifier for this template object This value cannot be null.
button ControlButton: a ControlButton that can show the current state and toggle it This value cannot be null.

Public methods

getContentDescription

Added in API level 30
fun getContentDescription(): CharSequence
Return
CharSequence This value cannot be null.

getTemplateType

Added in API level 30
fun getTemplateType(): Int
Return
Int ControlTemplate.TYPE_TOGGLE

isChecked

Added in API level 30
fun isChecked(): Boolean