Distance

public final class Distance
extends Object

java.lang.Object
   ↳ androidx.car.app.model.Distance


Represents a distance value and how it should be displayed in the UI.

Summary

Constants

int UNIT_FEET

Feet unit.

int UNIT_KILOMETERS

Kilometer unit.

int UNIT_KILOMETERS_P1

Kilometer unit with the additional requirement that distances of this type be displayed with at least 1 digit of precision after the decimal point (for example, 2.0).

int UNIT_METERS

Meter unit.

int UNIT_MILES

Miles unit.

int UNIT_MILES_P1

Mile unit with the additional requirement that distances of this type be displayed with at least 1 digit of precision after the decimal point (for example, 2.0).

int UNIT_YARDS

Yards unit.

Public methods

static Distance create(double displayDistance, int displayUnit)

Constructs a new instance of a Distance.

boolean equals(Object other)
double getDisplayDistance()

Returns the distance measured in the unit indicated at getDisplayUnit().

int getDisplayUnit()

Returns the unit that should be used to display the distance value, adjusted to the current user's locale and location.

int hashCode()
String toString()

Inherited methods