MessageInfo.Builder


public final class MessageInfo.Builder


A builder of MessageInfo.

Summary

Public constructors

Returns a new instance of a Builder.

Returns a new instance of a Builder.

Public methods

@NonNull MessageInfo

Constructs the MessageInfo defined by this builder.

@NonNull MessageInfo.Builder

Sets the image to display along with the message.

@NonNull MessageInfo.Builder

Sets additional text on the message, with support for multiple length variants.

@NonNull MessageInfo.Builder

Sets additional text on the message.

@NonNull MessageInfo.Builder

Sets the title of the message.

Public constructors

Builder

Added in 1.0.0
public Builder(@NonNull CarText title)

Returns a new instance of a Builder.

Spans are not supported in the input string and will be ignored.

Throws
java.lang.NullPointerException

if title is null

Builder

Added in 1.0.0
public Builder(@NonNull CharSequence title)

Returns a new instance of a Builder.

Only DistanceSpans and DurationSpans are supported in the input string.

Throws
java.lang.NullPointerException

if title is null

java.lang.IllegalArgumentException

if title contains unsupported spans

Public methods

build

Added in 1.0.0
public @NonNull MessageInfo build()

Constructs the MessageInfo defined by this builder.

setImage

Added in 1.0.0
public @NonNull MessageInfo.Builder setImage(@NonNull CarIcon image)

Sets the image to display along with the message.

Image Sizing Guidance To minimize scaling artifacts across a wide range of car screens, apps should provide images targeting a 128 x 128 dp bounding box. If the image exceeds this maximum size in either one of the dimensions, it will be scaled down to be centered inside the bounding box while preserving the aspect ratio.

See CarIcon for more details related to providing icon and image resources that work with different car screen pixel densities.

Throws
java.lang.NullPointerException

if image is null

setText

Added in 1.0.0
public @NonNull MessageInfo.Builder setText(@NonNull CarText text)

Sets additional text on the message, with support for multiple length variants.

Only DistanceSpans and DurationSpans are supported in the input string.

Throws
java.lang.NullPointerException

if text is null

java.lang.IllegalArgumentException

if text contains unsupported spans

See also
CarText

setText

Added in 1.0.0
public @NonNull MessageInfo.Builder setText(@NonNull CharSequence text)

Sets additional text on the message.

Only DistanceSpans and DurationSpans are supported in the input string.

Throws
java.lang.NullPointerException

if text is null

java.lang.IllegalArgumentException

if text contains unsupported spans

See also
CarText

setTitle

Added in 1.0.0
public @NonNull MessageInfo.Builder setTitle(@NonNull CharSequence title)

Sets the title of the message.

Only DistanceSpans and DurationSpans are supported in the input string.

Throws
java.lang.NullPointerException

if title is null

java.lang.IllegalArgumentException

if title contains unsupported spans

See also
CarText