public final class

Trip.Builder

extends java.lang.Object

 java.lang.Object

↳androidx.car.app.navigation.model.Trip.Builder

Overview

A builder of Trip.

Summary

Constructors
publicBuilder()

Constructs an empty Trip.Builder instance.

Methods
public Trip.BuilderaddDestination(Destination destination, TravelEstimate destinationTravelEstimate)

Adds a destination to the trip.

public Trip.BuilderaddStep(Step step, TravelEstimate stepTravelEstimate)

Adds a step to the trip.

public Tripbuild()

Constructs the Trip defined by this builder.

public Trip.BuildersetCurrentRoad(java.lang.CharSequence currentRoad)

Sets a description of the current road.

public Trip.BuildersetLoading(boolean isLoading)

Sets whether the Trip is in a loading state.

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

Constructors

public Builder()

Constructs an empty Trip.Builder instance.

Methods

public Trip.Builder addDestination(Destination destination, TravelEstimate destinationTravelEstimate)

Adds a destination to the trip.

Destinations must be added in order of arrival. A destination is not required. Display surfaces may or may not use the destination and if multiple destinations are added the display may only show information about the first destination.

For every destination added, a corresponding TravelEstimate must be provided. Display surfaces may or may not use the destination travel estimate and if multiple destination travel estimates are added the display may only show information about the first destination travel estimate.

public Trip.Builder addStep(Step step, TravelEstimate stepTravelEstimate)

Adds a step to the trip.

Steps must be added in order of arrival. A step is not required. Display surfaces may or may not use the step and if multiple steps are added the display may only show information about the first step.

For every step added, a corresponding TravelEstimate must be provided. Display surfaces may or may not use the step travel estimate and if multiple step travel estimates are added the display may only show information about the first step travel estimate.

public Trip.Builder setCurrentRoad(java.lang.CharSequence currentRoad)

Sets a description of the current road.

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

See also: CarText

public Trip.Builder setLoading(boolean isLoading)

Sets whether the Trip is in a loading state.

If set to true, the UI may show a loading indicator, and adding any steps or step travel estimates will throw an java.lang.IllegalArgumentException.

public Trip build()

Constructs the Trip defined by this builder.