Toggle.Builder
class Toggle.Builder
A builder of Toggle.
Summary
Public constructors |
|---|
Builder(onCheckedChangeListener: Toggle.OnCheckedChangeListener)Returns a new instance of a |
Public functions |
|
|---|---|
Toggle |
build()Constructs the |
Toggle.Builder |
setChecked(checked: Boolean)Sets the initial checked state for |
Toggle.Builder |
@RequiresCarApi(value = 5)Sets the initial enabled state for |
Public constructors
Builder
Builder(onCheckedChangeListener: Toggle.OnCheckedChangeListener)
Returns a new instance of a Builder with the given OnCheckedChangeListener.
Note that the listener relates to UI events and will be executed on the main thread using getMainLooper.
| Throws | |
|---|---|
java.lang.NullPointerException |
if |
Public functions
setChecked
fun setChecked(checked: Boolean): Toggle.Builder
Sets the initial checked state for Toggle.
The default state of a Toggle is unchecked.
setEnabled
@RequiresCarApi(value = 5)
fun setEnabled(enabled: Boolean): Toggle.Builder
Sets the initial enabled state for Toggle.
The default state of a Toggle is enabled.