public final class

Suggestion.Builder

extends java.lang.Object

 java.lang.Object

↳androidx.car.app.suggestion.model.Suggestion.Builder

Overview

A builder of Suggestion.

Summary

Constructors
publicBuilder()

Returns an empty Suggestion.Builder instance.

Methods
public Suggestionbuild()

Constructs the Suggestion defined by this builder.

public Suggestion.BuildersetAction(PendingIntent action)

Sets the PendingIntent for the suggestion action.

public Suggestion.BuildersetIcon(CarIcon icon)

Sets a suggestion image to display.

public Suggestion.BuildersetIdentifier(java.lang.String identifier)

Sets the suggestion identifier.

public Suggestion.BuildersetSubtitle(java.lang.CharSequence subtitle)

Sets the suggestion subtitle formatted for the user's current locale.

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

Sets the suggestion title formatted for the user's current locale.

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

Constructors

public Builder()

Returns an empty Suggestion.Builder instance.

Methods

public Suggestion.Builder setIdentifier(java.lang.String identifier)

Sets the suggestion identifier.

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

Sets the suggestion title formatted for the user's current locale.

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

See also: CarText

public Suggestion.Builder setSubtitle(java.lang.CharSequence subtitle)

Sets the suggestion subtitle formatted for the user's current locale.

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

See also: CarText

public Suggestion.Builder setAction(PendingIntent action)

Sets the PendingIntent for the suggestion action.

public Suggestion.Builder setIcon(CarIcon icon)

Sets a suggestion image to display.

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. Icon images are expected to be tintable.

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

public Suggestion build()

Constructs the Suggestion defined by this builder.