Suggestion.Builder


class Suggestion.Builder


A builder of Suggestion.

Summary

Public constructors

Returns an empty Builder instance.

Public functions

Suggestion

Constructs the Suggestion defined by this builder.

Suggestion.Builder

Sets the PendingIntent for the suggestion action.

Suggestion.Builder

Sets a suggestion image to display.

Suggestion.Builder
setIdentifier(identifier: String)

Sets the suggestion identifier.

Suggestion.Builder

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

Suggestion.Builder

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

Public constructors

Builder

Added in 1.3.0
Builder()

Returns an empty Builder instance.

Public functions

build

Added in 1.3.0
fun build(): Suggestion

Constructs the Suggestion defined by this builder.

Throws
java.lang.IllegalStateException

if any of the files are null or if the title and the subtitle are empty.

setAction

Added in 1.3.0
fun setAction(action: PendingIntent): Suggestion.Builder

Sets the PendingIntent for the suggestion action.

Throws
java.lang.NullPointerException

if pendingIntent is null

setIcon

Added in 1.3.0
fun setIcon(icon: CarIcon): Suggestion.Builder

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.

Throws
java.lang.NullPointerException

if image is null

setIdentifier

Added in 1.3.0
fun setIdentifier(identifier: String): Suggestion.Builder

Sets the suggestion identifier.

Throws
java.lang.NullPointerException

if identifier is null

setSubtitle

Added in 1.3.0
fun setSubtitle(subtitle: CharSequence): Suggestion.Builder

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

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

Throws
java.lang.NullPointerException

if subtitle is null

See also
CarText

setTitle

Added in 1.3.0
fun setTitle(title: CharSequence): Suggestion.Builder

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

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

Throws
java.lang.NullPointerException

if title is null

See also
CarText