# Destination.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/Destination.java+class:androidx.car.app.navigation.model.Destination.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/Destination.Builder "View this page in Java")


```
class Destination.Builder
```

<br />

*** ** * ** ***

A builder of `https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/Destination`.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/Destination.Builder#Builder()()` Returns an empty `https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/Destination.Builder` instance. |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/Destination` | `https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/Destination.Builder#build()()` Constructs the `https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/Destination` defined by this builder. |
| `https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/Destination.Builder` | `https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/Destination.Builder#setAddress(java.lang.CharSequence)(address: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html)` Sets the destination address formatted for the user's current locale. |
| `https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/Destination.Builder` | `https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/Destination.Builder#setImage(androidx.car.app.model.CarIcon)(image: https://developer.android.com/reference/kotlin/androidx/car/app/model/CarIcon)` Sets the destination image to display. |
| `https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/Destination.Builder` | `https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/Destination.Builder#setName(java.lang.CharSequence)(name: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html)` Sets the destination name formatted for the user's current locale. |

## Public constructors

### Builder

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

```
Builder()
```

Returns an empty `https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/Destination.Builder` instance.

## Public functions

### build

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

```
fun build(): Destination
```

Constructs the `https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/Destination` defined by this builder.

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

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | if both the name and the address are `null` or empty. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/Destination.Builder#setName(java.lang.CharSequence)` |   |
| `https://developer.android.com/reference/kotlin/androidx/car/app/navigation/model/Destination.Builder#setAddress(java.lang.CharSequence)` |   |

### setAddress

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

```
fun setAddress(address: CharSequence): Destination.Builder
```

Sets the destination address formatted for the user's current locale.

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

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/NullPointerException.html` | if `address` is `null` |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/CarText` |   |

### setImage

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

```
fun setImage(image: CarIcon): Destination.Builder
```

Sets the destination 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.

See `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 |
|---|---|
| `https://developer.android.com/reference/java/lang/NullPointerException.html` | if `image` is `null` |

### setName

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

```
fun setName(name: CharSequence): Destination.Builder
```

Sets the destination name formatted for the user's current locale.

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

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/NullPointerException.html` | if `name` is `null` |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/CarText` |   |