public final class

LongMessageTemplate.Builder

extends java.lang.Object

 java.lang.Object

↳androidx.car.app.model.LongMessageTemplate.Builder

Overview

A builder of LongMessageTemplate.

Summary

Constructors
publicBuilder(java.lang.CharSequence message)

Returns a LongMessageTemplate.Builder instance.

Methods
public LongMessageTemplate.BuilderaddAction(Action action)

Adds an Action to display along with the message.

public LongMessageTemplatebuild()

Constructs the LongMessageTemplate defined by this builder.

public LongMessageTemplate.BuildersetActionStrip(ActionStrip actionStrip)

Sets the ActionStrip for this template or null to not display an ActionStrip.

public LongMessageTemplate.BuildersetHeaderAction(Action headerAction)

Sets the Action that will be displayed in the header of the template.

public LongMessageTemplate.BuildersetTitle(java.lang.CharSequence title)

Sets the title of the template.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public Builder(java.lang.CharSequence message)

Returns a LongMessageTemplate.Builder instance.

Parameters:

message: the text message to display in the template. This message will only be displayed when the car is parked.

Methods

public LongMessageTemplate.Builder setTitle(java.lang.CharSequence title)

Sets the title of the template.

Unless set with this method, the template will not have a title.

Only DistanceSpans and DurationSpans are supported in the input string.

See also: CarText

public LongMessageTemplate.Builder setHeaderAction(Action headerAction)

Sets the Action that will be displayed in the header of the template.

Unless set with this method, the template will not have a header action.

Requirements

This template only supports either one of Action.APP_ICON and Action.BACK as a header Action.

public LongMessageTemplate.Builder setActionStrip(ActionStrip actionStrip)

Sets the ActionStrip for this template or null to not display an ActionStrip.

Unless set with this method, the template will not have an action strip.

Requirements

This template allows up to 2 Actions in its ActionStrip. Of the 2 allowed Actions, one of them can contain a title as set via Action.Builder.setTitle(CharSequence). Otherwise, only Actions with icons are allowed.

public LongMessageTemplate.Builder addAction(Action action)

Adds an Action to display along with the message.

Requirements

This template allows up to 2 Actions in its body, and they must use a ParkedOnlyOnClickListener. One of these actions can be declared as primary via Action.Builder.setFlags(int). Each action's title color can be customized with ForegroundCarColorSpan instances. Any other span is not supported.

public LongMessageTemplate build()

Constructs the LongMessageTemplate defined by this builder.

Requirements

A non-empty message must be set on the template.

Either a header Action or title must be set on the template.