MessageInfo.Builder

class MessageInfo.Builder


A builder of MessageInfo.

Summary

Public constructors

Builder(title: CarText)

Returns a new instance of a Builder.

Returns a new instance of a Builder.

Public functions

MessageInfo

Constructs the MessageInfo defined by this builder.

MessageInfo.Builder
setImage(image: CarIcon)

Sets the image to display along with the message.

MessageInfo.Builder

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

MessageInfo.Builder

Sets additional text on the message.

MessageInfo.Builder

Sets the title of the message.

Public constructors

Builder

Added in 1.0.0
Builder(title: CarText)

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
Builder(title: CharSequence)

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 functions

build

Added in 1.0.0
fun build(): MessageInfo

Constructs the MessageInfo defined by this builder.

setImage

Added in 1.0.0
fun setImage(image: CarIcon): MessageInfo.Builder

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
fun setText(text: CarText): MessageInfo.Builder

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
fun setText(text: CharSequence): MessageInfo.Builder

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
fun setTitle(title: CharSequence): MessageInfo.Builder

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