MessageInfo.Builder
public final class MessageInfo.Builder
A builder of MessageInfo.
Summary
Public constructors |
|---|
|
Returns a new instance of a |
Builder(@NonNull CharSequence title)Returns a new instance of a |
Public methods |
|
|---|---|
@NonNull MessageInfo |
build()Constructs the |
@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 |
setText(@NonNull CharSequence text)Sets additional text on the message. |
@NonNull MessageInfo.Builder |
setTitle(@NonNull CharSequence title)Sets the title of the message. |
Public constructors
Builder
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 |
Builder
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 |
java.lang.IllegalArgumentException |
if |
Public methods
build
public @NonNull MessageInfo build()
Constructs the MessageInfo defined by this builder.
setImage
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 |
setText
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 |
java.lang.IllegalArgumentException |
if |
| See also | |
|---|---|
CarText |
setText
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 |
java.lang.IllegalArgumentException |
if |
| See also | |
|---|---|
CarText |
setTitle
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 |
java.lang.IllegalArgumentException |
if |
| See also | |
|---|---|
CarText |