Toggle


@CarProtocol
public final class Toggle


Represents a toggle that can have either a checked or unchecked state.

Toggles are allowed in Map and Pane templates from API >= 6. Old hosts may render bad UI if the toggles are added to hosts that don't support them.

Summary

Nested types

public final class Toggle.Builder

A builder of Toggle.

A listener for handling checked state change events.

Public methods

boolean
@NonNull OnCheckedChangeDelegate

Returns the OnCheckedChangeDelegate that is called when the checked state of the Toggle is changed.

int
boolean

Returns true if the toggle is checked.

boolean
@RequiresCarApi(value = 5)
isEnabled()

Returns true if the toggle is enabled.

@NonNull String

Public methods

equals

public boolean equals(@Nullable Object other)

getOnCheckedChangeDelegate

Added in 1.0.0
public @NonNull OnCheckedChangeDelegate getOnCheckedChangeDelegate()

Returns the OnCheckedChangeDelegate that is called when the checked state of the Toggle is changed.

hashCode

public int hashCode()

isChecked

Added in 1.0.0
public boolean isChecked()

Returns true if the toggle is checked.

isEnabled

Added in 1.3.0
@RequiresCarApi(value = 5)
public boolean isEnabled()

Returns true if the toggle is enabled.

toString

public @NonNull String toString()