# Length

Artifact: [androidx.health.connect:connect-client](https://developer.android.com/jetpack/androidx/releases/health-connect) [View Source](https://cs.android.com/search?q=file:androidx/health/connect/client/units/Length.kt+class:androidx.health.connect.client.units.Length) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/health-connect#1.1.0)

*** ** * ** ***


```
public final class Length implements Comparable<@NonNull Length>
```

<br />

*** ** * ** ***

Represents a unit of length. Supported units: meters, kilometers, miles, inches and feet.

## Summary

| ### Public methods |
|---|---|
| `int` | `https://developer.android.com/reference/androidx/health/connect/client/units/Length#compareTo(androidx.health.connect.client.units.Length)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/units/Length other)` |
| `boolean` | `https://developer.android.com/reference/androidx/health/connect/client/units/Length#equals(kotlin.Any)(https://developer.android.com/reference/java/lang/Object.html other)` |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/units/Length` | `https://developer.android.com/reference/androidx/health/connect/client/units/Length#feet(kotlin.Double)(double value)` Creates `https://developer.android.com/reference/androidx/health/connect/client/units/Length` with the specified value in feet. |
| `final double` | `https://developer.android.com/reference/androidx/health/connect/client/units/Length#getFeet()()` Returns the length in feet. |
| `final double` | `https://developer.android.com/reference/androidx/health/connect/client/units/Length#getInches()()` Returns the length in inches. |
| `final double` | `https://developer.android.com/reference/androidx/health/connect/client/units/Length#getKilometers()()` Returns the length in kilometers. |
| `final double` | `https://developer.android.com/reference/androidx/health/connect/client/units/Length#getMeters()()` Returns the length in meters. |
| `final double` | `https://developer.android.com/reference/androidx/health/connect/client/units/Length#getMiles()()` Returns the length in miles. |
| `int` | `https://developer.android.com/reference/androidx/health/connect/client/units/Length#hashCode()()` |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/units/Length` | `https://developer.android.com/reference/androidx/health/connect/client/units/Length#inches(kotlin.Double)(double value)` Creates `https://developer.android.com/reference/androidx/health/connect/client/units/Length` with the specified value in inches. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/units/Length` | `https://developer.android.com/reference/androidx/health/connect/client/units/Length#kilometers(kotlin.Double)(double value)` Creates `https://developer.android.com/reference/androidx/health/connect/client/units/Length` with the specified value in kilometers. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/units/Length` | `https://developer.android.com/reference/androidx/health/connect/client/units/Length#meters(kotlin.Double)(double value)` Creates `https://developer.android.com/reference/androidx/health/connect/client/units/Length` with the specified value in meters. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/units/Length` | `https://developer.android.com/reference/androidx/health/connect/client/units/Length#miles(kotlin.Double)(double value)` Creates `https://developer.android.com/reference/androidx/health/connect/client/units/Length` with the specified value in miles. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/health/connect/client/units/Length#toString()()` |

## Public methods

### compareTo

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

```
public int compareTo(@NonNull Length other)
```

### equals

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

### feet

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

```
public static final @NonNull Length feet(double value)
```

Creates `https://developer.android.com/reference/androidx/health/connect/client/units/Length` with the specified value in feet.

### getFeet

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

```
public final double getFeet()
```

Returns the length in feet.

### getInches

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

```
public final double getInches()
```

Returns the length in inches.

### getKilometers

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

```
public final double getKilometers()
```

Returns the length in kilometers.

### getMeters

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

```
public final double getMeters()
```

Returns the length in meters.

### getMiles

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

```
public final double getMiles()
```

Returns the length in miles.

### hashCode

```
public int hashCode()
```

### inches

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

```
public static final @NonNull Length inches(double value)
```

Creates `https://developer.android.com/reference/androidx/health/connect/client/units/Length` with the specified value in inches.

### kilometers

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

```
public static final @NonNull Length kilometers(double value)
```

Creates `https://developer.android.com/reference/androidx/health/connect/client/units/Length` with the specified value in kilometers.

### meters

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

```
public static final @NonNull Length meters(double value)
```

Creates `https://developer.android.com/reference/androidx/health/connect/client/units/Length` with the specified value in meters.

### miles

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

```
public static final @NonNull Length miles(double value)
```

Creates `https://developer.android.com/reference/androidx/health/connect/client/units/Length` with the specified value in miles.

### toString

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