# Mileage.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/hardware/info/Mileage.java+class:androidx.car.app.hardware.info.Mileage.Builder) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.1.0)

*** ** * ** ***


```
public final class Mileage.Builder
```

<br />

*** ** * ** ***

A builder of `https://developer.android.com/reference/androidx/car/app/hardware/info/Mileage`.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/car/app/hardware/info/Mileage.Builder#Builder()()` |

| ### Public methods |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/car/app/hardware/info/Mileage` | `https://developer.android.com/reference/androidx/car/app/hardware/info/Mileage.Builder#build()()` Constructs the `https://developer.android.com/reference/androidx/car/app/hardware/info/Mileage` defined by this builder. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/car/app/hardware/info/Mileage.Builder` | `https://developer.android.com/reference/androidx/car/app/hardware/info/Mileage.Builder#setDistanceDisplayUnit(androidx.car.app.hardware.common.CarValue<java.lang.Integer>)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/car/app/hardware/common/CarValue<https://developer.android.com/reference/java/lang/Integer.html> mileageDisplayUnit)` Sets the mileage display unit. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/car/app/hardware/info/Mileage.Builder` | `https://developer.android.com/reference/androidx/car/app/hardware/info/Mileage.Builder#setOdometerMeters(androidx.car.app.hardware.common.CarValue<java.lang.Float>)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/car/app/hardware/common/CarValue<https://developer.android.com/reference/java/lang/Float.html> odometerMeters)` Sets the odometer value in KILOMETERS. |

## Public constructors

### Builder

Added in 1.1.0

```
public Builder()
```

## Public methods

### build

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

```
public @NonNull Mileage build()
```

Constructs the `https://developer.android.com/reference/androidx/car/app/hardware/info/Mileage` defined by this builder.

### setDistanceDisplayUnit

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

```
public @NonNull Mileage.Builder setDistanceDisplayUnit(@NonNull CarValue<Integer> mileageDisplayUnit)
```

Sets the mileage display unit.

Valid values are in `https://developer.android.com/reference/androidx/car/app/hardware/common/CarUnit`.

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

### setOdometerMeters

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

```
public @NonNull Mileage.Builder setOdometerMeters(@NonNull CarValue<Float> odometerMeters)
```

Sets the odometer value in KILOMETERS. The API name is staying as "meters" in order to not break backwards compatibility.

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