Destination.Builder

public static final class Destination.Builder
extends Object

java.lang.Object
   ↳ com.google.android.libraries.car.app.navigation.model.Destination.Builder


A builder of Destination.

Summary

Public methods

Destination build()

Constructs the Destination defined by this builder.

Destination.Builder setAddress(CharSequence address)

Sets the destination address formatted for the user's current locale, or null to not display an address.

Destination.Builder setImage(CarIcon image)

Sets the destination image to display, or null to not display an image.

Destination.Builder setName(CharSequence name)

Sets the destination name formatted for the user's current locale, or null to not display a destination name.

Inherited methods

Public methods

build

public Destination build ()

Constructs the Destination defined by this builder.

At least one of the name or the address must be set and not empty.

Returns
Destination

Throws
IllegalStateException if both the name and the address are null or empty.

setAddress

public Destination.Builder setAddress (CharSequence address)

Sets the destination address formatted for the user's current locale, or null to not display an address.

Parameters
address CharSequence

Returns
Destination.Builder

setImage

public Destination.Builder setImage (CarIcon image)

Sets the destination image to display, or null to not display an image.

Image Sizing Guidance

The provided image should have a maximum size of 64 x 64 dp. If the image exceeds this maximum size in either one of the dimensions, it will be scaled down and 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.

Parameters
image CarIcon

Returns
Destination.Builder

setName

public Destination.Builder setName (CharSequence name)

Sets the destination name formatted for the user's current locale, or null to not display a destination name.

Parameters
name CharSequence

Returns
Destination.Builder