# Mileage

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

*** ** * ** ***


```
@CarProtocol
@RequiresCarApi(value = 3)
public final class Mileage
```

<br />

*** ** * ** ***

Information about car mileage.

## Summary

| ### Nested types |
|---|
| `public final class https://developer.android.com/reference/androidx/car/app/hardware/info/Mileage.Builder` A builder of `https://developer.android.com/reference/androidx/car/app/hardware/info/Mileage`. |

| ### Public methods |
|---|---|
| `boolean` | `https://developer.android.com/reference/androidx/car/app/hardware/info/Mileage#equals(java.lang.Object)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/Object.html other)` |
| `@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>` | `https://developer.android.com/reference/androidx/car/app/hardware/info/Mileage#getDistanceDisplayUnit()()` Returns the distance display unit from the car hardware. |
| `@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>` | `https://developer.android.com/reference/androidx/car/app/hardware/info/Mileage#getOdometerInKilometers()()` Returns the value of the odometer from the car hardware in kilometers. |
| `@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>` | `[getOdometerMeters](https://developer.android.com/reference/androidx/car/app/hardware/info/Mileage#getOdometerMeters())()` **This method is deprecated.** use `https://developer.android.com/reference/androidx/car/app/hardware/info/Mileage#getOdometerInKilometers()` which does the same as this method, except that the correct units are in the API name <br /> |
| `int` | `https://developer.android.com/reference/androidx/car/app/hardware/info/Mileage#hashCode()()` |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/car/app/hardware/info/Mileage#toString()()` |

## Public methods

### equals

```
public boolean equals(@Nullable Object other)
```

### getDistanceDisplayUnit

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

```
public @NonNull CarValue<Integer> getDistanceDisplayUnit()
```

Returns the distance display unit from the car hardware.

See `https://developer.android.com/reference/androidx/car/app/hardware/common/CarUnit` for possible distance values.

### getOdometerInKilometers

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

```
public @NonNull CarValue<Float> getOdometerInKilometers()
```

Returns the value of the odometer from the car hardware in kilometers. The precision of this value depends on the hardware implementation. Some vehicles may return whole kilomters, while others may return down to tenths or hundredths of a kilometer.

### getOdometerMeters

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

```
public @NonNull CarValue<Float> [getOdometerMeters](https://developer.android.com/reference/androidx/car/app/hardware/info/Mileage#getOdometerMeters())()
```

> [!CAUTION]
> **This method is deprecated.**   
>
> use `https://developer.android.com/reference/androidx/car/app/hardware/info/Mileage#getOdometerInKilometers()` which does the same as this method, except that the correct units are in the API name

Returns the value of the odometer from the car hardware in KILOMETERS. Despite the name "meters", this method actually returns the odometer in kilometers. It was incorrectly introduced as meters and due to backwards compatibility concerns, can no longer be renamed or removed.

### hashCode

```
public int hashCode()
```

### toString

```
public @NonNull String toString()
```