# TravelEstimate.Builder

# TravelEstimate.Builder

Artifact:[androidx.car.app:app](https://developer.android.com/jetpack/androidx/releases/car-app)  
[View Source](https://cs.android.com/search?q=file:androidx/car/app/navigation/model/TravelEstimate.java+class:androidx.car.app.navigation.model.TravelEstimate.Builder)  
Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.0.0)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/car/app/navigation/model/TravelEstimate.Builder "View this page in Java")

<br />

```
class TravelEstimate.Builder
```

<br />

*** ** * ** ***

A builder of[TravelEstimate](https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/TravelEstimate).

## Summary

|                                                                                                                                                                                                                                                                                                                                    ### Public constructors                                                                                                                                                                                                                                                                                                                                     |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Builder](https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/TravelEstimate.Builder#Builder(androidx.car.app.model.Distance,androidx.car.app.model.DateTimeWithZone))`(` ` remainingDistance: `[Distance](https://developer.android.com/reference/kotlin/androidx/car/app/model/Distance)`,` ` arrivalTimeAtDestination: `[DateTimeWithZone](https://developer.android.com/reference/kotlin/androidx/car/app/model/DateTimeWithZone) `)` Constructs a new builder of[TravelEstimate](https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/TravelEstimate).                                                                           |
| `@`[RequiresApi](https://developer.android.com/reference/kotlin/androidx/annotation/RequiresApi)`(value = 26)` [Builder](https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/TravelEstimate.Builder#Builder(androidx.car.app.model.Distance,java.time.ZonedDateTime))`(` ` remainingDistance: `[Distance](https://developer.android.com/reference/kotlin/androidx/car/app/model/Distance)`,` ` arrivalTimeAtDestination: `[ZonedDateTime](https://developer.android.com/reference/java/time/ZonedDateTime.html) `)` Constructs a new builder of[TravelEstimate](https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/TravelEstimate). |

|                                                       ### Public functions                                                        |
|-----------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [TravelEstimate](https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/TravelEstimate)                 | [build](https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/TravelEstimate.Builder#build())`()` Constructs the[TravelEstimate](https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/TravelEstimate)defined by this builder.                                                                                                                                                                                                                                                                                                                                                                       |
| [TravelEstimate.Builder](https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/TravelEstimate.Builder) | [setRemainingDistanceColor](https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/TravelEstimate.Builder#setRemainingDistanceColor(androidx.car.app.model.CarColor))`(remainingDistanceColor: `[CarColor](https://developer.android.com/reference/kotlin/androidx/car/app/model/CarColor)`)` Sets the color of the remaining distance text.                                                                                                                                                                                                                                                                                     |
| [TravelEstimate.Builder](https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/TravelEstimate.Builder) | `@`[RequiresApi](https://developer.android.com/reference/kotlin/androidx/annotation/RequiresApi)`(value = 26)` [setRemainingTime](https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/TravelEstimate.Builder#setRemainingTime(java.time.Duration))`(remainingTime: `[Duration](https://developer.android.com/reference/java/time/Duration.html)`)` Sets the estimated time remaining until arriving at the destination.                                                                                                                                                                                                       |
| [TravelEstimate.Builder](https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/TravelEstimate.Builder) | [setRemainingTimeColor](https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/TravelEstimate.Builder#setRemainingTimeColor(androidx.car.app.model.CarColor))`(remainingTimeColor: `[CarColor](https://developer.android.com/reference/kotlin/androidx/car/app/model/CarColor)`)` Sets the color of the remaining time text.                                                                                                                                                                                                                                                                                                     |
| [TravelEstimate.Builder](https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/TravelEstimate.Builder) | [setRemainingTimeSeconds](https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/TravelEstimate.Builder#setRemainingTimeSeconds(long))`(remainingTimeSeconds: @`[IntRange](https://developer.android.com/reference/kotlin/androidx/annotation/IntRange)`(from = "-1") `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`)` Sets the estimated time remaining until arriving at the destination, in seconds.                                                                                                                                                                                         |
| [TravelEstimate.Builder](https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/TravelEstimate.Builder) | `@`[RequiresCarApi](https://developer.android.com/reference/kotlin/androidx/car/app/annotations/RequiresCarApi)`(value = 5)` [setTripIcon](https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/TravelEstimate.Builder#setTripIcon(androidx.car.app.model.CarIcon))`(tripIcon: `[CarIcon](https://developer.android.com/reference/kotlin/androidx/car/app/model/CarIcon)`)` Sets a[CarIcon](https://developer.android.com/reference/kotlin/androidx/car/app/model/CarIcon)that is associated with the current[TravelEstimate](https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/TravelEstimate) |
| [TravelEstimate.Builder](https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/TravelEstimate.Builder) | `@`[RequiresCarApi](https://developer.android.com/reference/kotlin/androidx/car/app/annotations/RequiresCarApi)`(value = 5)` [setTripText](https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/TravelEstimate.Builder#setTripText(androidx.car.app.model.CarText))`(tripText: `[CarText](https://developer.android.com/reference/kotlin/androidx/car/app/model/CarText)`)` Sets the trip text.                                                                                                                                                                                                                                |

## Public constructors

### Builder

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.0.0)  

```
Builder(
    remainingDistance: Distance,
    arrivalTimeAtDestination: DateTimeWithZone
)
```

Constructs a new builder of[TravelEstimate](https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/TravelEstimate).  

|                                                               Parameters                                                               |
|----------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------|
| `remainingDistance: `[Distance](https://developer.android.com/reference/kotlin/androidx/car/app/model/Distance)                        | The estimated remaining[Distance](https://developer.android.com/reference/kotlin/androidx/car/app/model/Distance)until arriving at the destination |
| `arrivalTimeAtDestination: `[DateTimeWithZone](https://developer.android.com/reference/kotlin/androidx/car/app/model/DateTimeWithZone) | The arrival time with the time zone information provided for the destination                                                                       |

|                                                    Throws                                                     |
|---------------------------------------------------------------------------------------------------------------|------------------------------------------------------------|
| [java.lang.NullPointerException](https://developer.android.com/reference/java/lang/NullPointerException.html) | if`remainingDistance`or`arrivalTimeAtDestination`are`null` |

### Builder

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.0.0)  

```
@RequiresApi(value = 26)
Builder(
    remainingDistance: Distance,
    arrivalTimeAtDestination: ZonedDateTime
)
```

Constructs a new builder of[TravelEstimate](https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/TravelEstimate).  

|                                                    Parameters                                                     |
|-------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------|
| `remainingDistance: `[Distance](https://developer.android.com/reference/kotlin/androidx/car/app/model/Distance)   | The estimated remaining[Distance](https://developer.android.com/reference/kotlin/androidx/car/app/model/Distance)until arriving at the destination |
| `arrivalTimeAtDestination: `[ZonedDateTime](https://developer.android.com/reference/java/time/ZonedDateTime.html) | The arrival time with the time zone information provided for the destination                                                                       |

|                                                    Throws                                                     |
|---------------------------------------------------------------------------------------------------------------|------------------------------------------------------------|
| [java.lang.NullPointerException](https://developer.android.com/reference/java/lang/NullPointerException.html) | if`remainingDistance`or`arrivalTimeAtDestination`are`null` |

## Public functions

### build

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.0.0)  

```
fun build(): TravelEstimate
```

Constructs the[TravelEstimate](https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/TravelEstimate)defined by this builder.  

### setRemainingDistanceColor

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.0.0)  

```
fun setRemainingDistanceColor(remainingDistanceColor: CarColor): TravelEstimate.Builder
```

Sets the color of the remaining distance text.

Depending on contrast requirements, capabilities of the vehicle screens, or other factors, the color may be ignored by the host or overridden by the vehicle system.

If not set,[DEFAULT](https://developer.android.com/reference/kotlin/androidx/car/app/model/CarColor#DEFAULT())will be used.

Custom colors created with[createCustom](https://developer.android.com/reference/kotlin/androidx/car/app/model/CarColor#createCustom(int,int))are not supported.  

|                                                        Throws                                                         |
|-----------------------------------------------------------------------------------------------------------------------|--------------------------------------------|
| [java.lang.IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException.html) | if`remainingDistanceColor`is not supported |
| [java.lang.NullPointerException](https://developer.android.com/reference/java/lang/NullPointerException.html)         | if`remainingDistanceColor`is`null`         |

### setRemainingTime

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.0.0)  

```
@RequiresApi(value = 26)
fun setRemainingTime(remainingTime: Duration): TravelEstimate.Builder
```

Sets the estimated time remaining until arriving at the destination.

If not set,[REMAINING_TIME_UNKNOWN](https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/TravelEstimate#REMAINING_TIME_UNKNOWN())will be used.  

|                                                        Throws                                                         |
|-----------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [java.lang.IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException.html) | if`remainingTime`is a negative duration but not[REMAINING_TIME_UNKNOWN](https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/TravelEstimate#REMAINING_TIME_UNKNOWN()) |
| [java.lang.NullPointerException](https://developer.android.com/reference/java/lang/NullPointerException.html)         | if`remainingTime`is`null`                                                                                                                                                                         |

### setRemainingTimeColor

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.0.0)  

```
fun setRemainingTimeColor(remainingTimeColor: CarColor): TravelEstimate.Builder
```

Sets the color of the remaining time text.

Depending on contrast requirements, capabilities of the vehicle screens, or other factors, the color may be ignored by the host or overridden by the vehicle system.

If not set,[DEFAULT](https://developer.android.com/reference/kotlin/androidx/car/app/model/CarColor#DEFAULT())will be used.

Custom colors created with[createCustom](https://developer.android.com/reference/kotlin/androidx/car/app/model/CarColor#createCustom(int,int))are not supported.  

|                                                        Throws                                                         |
|-----------------------------------------------------------------------------------------------------------------------|----------------------------------------|
| [java.lang.IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException.html) | if`remainingTimeColor`is not supported |
| [java.lang.NullPointerException](https://developer.android.com/reference/java/lang/NullPointerException.html)         | if`remainingTimecolor`is`null`         |

### setRemainingTimeSeconds

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.0.0)  

```
fun setRemainingTimeSeconds(remainingTimeSeconds: @IntRange(from = "-1") Long): TravelEstimate.Builder
```

Sets the estimated time remaining until arriving at the destination, in seconds.

If not set,[REMAINING_TIME_UNKNOWN](https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/TravelEstimate#REMAINING_TIME_UNKNOWN())will be used.

Note that[REMAINING_TIME_UNKNOWN](https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/TravelEstimate#REMAINING_TIME_UNKNOWN())may not be supported depending on where the[TravelEstimate](https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/TravelEstimate)is used. See the documentation of where[TravelEstimate](https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/TravelEstimate)is used for any restrictions that might apply.  

|                                                        Throws                                                         |
|-----------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [java.lang.IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException.html) | if`remainingTimeSeconds`is a negative value but not[REMAINING_TIME_UNKNOWN](https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/TravelEstimate#REMAINING_TIME_UNKNOWN()) |

### setTripIcon

Added in[1.3.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.3.0)  

```
@RequiresCarApi(value = 5)
fun setTripIcon(tripIcon: CarIcon): TravelEstimate.Builder
```

Sets a[CarIcon](https://developer.android.com/reference/kotlin/androidx/car/app/model/CarIcon)that is associated with the current[TravelEstimate](https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/TravelEstimate)

See[CarIcon](https://developer.android.com/reference/kotlin/androidx/car/app/model/CarIcon)for more details related to providing icon and image resources that work with different car screen pixel densities.  

|                                                    Throws                                                     |
|---------------------------------------------------------------------------------------------------------------|----------------------|
| [java.lang.NullPointerException](https://developer.android.com/reference/java/lang/NullPointerException.html) | if`tripIcon`is`null` |

### setTripText

Added in[1.3.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.3.0)  

```
@RequiresCarApi(value = 5)
fun setTripText(tripText: CarText): TravelEstimate.Builder
```

Sets the trip text.

A text that provides additional information about this[TravelEstimate](https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/TravelEstimate), such as drop off/pick up information, and battery level, that should be displayed on the screen alongside the remaining distance and time.

For example "Pick up Alice", "Drop off Susan", or "Battery Level is Low".  

|                                                        Throws                                                         |
|-----------------------------------------------------------------------------------------------------------------------|----------------------------------------|
| [java.lang.NullPointerException](https://developer.android.com/reference/java/lang/NullPointerException.html)         | if`tripText`is`null`                   |
| [java.lang.IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException.html) | if`tripText`contains unsupported spans |

|                                         See also                                         |
|------------------------------------------------------------------------------------------|---|
| [CarText](https://developer.android.com/reference/kotlin/androidx/car/app/model/CarText) |   |