CarText.Builder

public static final class CarText.Builder
extends Object

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


A builder of CarText.

Summary

Public constructors

Builder(CharSequence text)

Returns a new instance of a CarText.Builder.

Public methods

CarText.Builder addVariant(CharSequence text)

Adds a text variant for the CarText instance.

CarText build()

Constructs the CarText defined by this builder.

Inherited methods

Public constructors

Builder

public Builder (CharSequence text)

Returns a new instance of a CarText.Builder.

Only CarSpan type spans are allowed in a CarText, other spans will be removed from the provided CharSequence.

Parameters
text CharSequence: the first variant of the text to use. This represents the app's preferred text variant. Other alternatives can be supplied with addVariant(CharSequence).

Throws
NullPointerException if the text is null

Public methods

addVariant