Toggle.Builder

public static final class Toggle.Builder
extends Object

java.lang.Object
   ↳ androidx.car.app.model.Toggle.Builder


A builder of Toggle.

Summary

Public constructors

Builder(Toggle.OnCheckedChangeListener onCheckedChangeListener)

Returns a new instance of a Toggle.Builder with the given Toggle.OnCheckedChangeListener.

Public methods

Toggle build()

Constructs the Toggle defined by this builder.

Toggle.Builder setChecked(boolean checked)

Sets the initial checked state for Toggle.

Inherited methods

Public constructors

Builder

public Builder (Toggle.OnCheckedChangeListener onCheckedChangeListener)

Returns a new instance of a Toggle.Builder with the given Toggle.OnCheckedChangeListener.

Note that the listener relates to UI events and will be executed on the main thread using Looper.getMainLooper().

Parameters
onCheckedChangeListener Toggle.OnCheckedChangeListener

Throws
NullPointerException if onCheckedChangeListener is null

Public methods

build

public Toggle build ()

Constructs the Toggle defined by this builder.

Returns
Toggle

setChecked

public Toggle.Builder setChecked (boolean checked)

Sets the initial checked state for Toggle.

The default state of a Toggle is unchecked.

Parameters
checked boolean

Returns
Toggle.Builder