BooleanAction


public final class BooleanAction
extends ControlAction

java.lang.Object
   ↳ android.service.controls.actions.ControlAction
     ↳ android.service.controls.actions.BooleanAction


Action sent by user toggling a Control between checked/unchecked. This action is available when the Control was constructed with either a ToggleTemplate or a ToggleRangeTemplate.

Summary

Inherited constants

Public constructors

BooleanAction(String templateId, boolean newState)
BooleanAction(String templateId, boolean newState, String challengeValue)

Public methods

int getActionType()

The action type associated with this class.

boolean getNewState()

The new state set for the button in the corresponding ToggleTemplate.

Inherited methods

Public constructors

BooleanAction

Added in API level 30
public BooleanAction (String templateId, 
                boolean newState)

Parameters
templateId String: the identifier of the ToggleTemplate that produced this action. This value cannot be null.

newState boolean: new value for the state displayed by the ToggleTemplate.

BooleanAction

Added in API level 30
public BooleanAction (String templateId, 
                boolean newState, 
                String challengeValue)

Parameters
templateId String: the identifier of the template that originated this action. This value cannot be null.

newState boolean: new value for the state displayed by the template.

challengeValue String: a value sent by the user along with the action to authenticate. null is sent when no authentication is needed or has not been requested.

Public methods

getActionType

Added in API level 30
public int getActionType ()

The action type associated with this class.

Returns
int ControlAction#TYPE_BOOLEAN

getNewState

Added in API level 30
public boolean getNewState ()

The new state set for the button in the corresponding ToggleTemplate.

Returns
boolean true if the button was toggled from unchecked to checked.