# ExerciseCompletionGoal.DistanceAndDurationGoal

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/records/ExerciseCompletionGoal.kt+class:androidx.health.connect.client.records.ExerciseCompletionGoal.DistanceAndDurationGoal) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/health-connect#1.1.0)

*** ** * ** ***


```
public final class ExerciseCompletionGoal.DistanceAndDurationGoal extends ExerciseCompletionGoal
```

<br />

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) |||
| ↳ | [androidx.health.connect.client.records.ExerciseCompletionGoal](https://developer.android.com/reference/androidx/health/connect/client/records/ExerciseCompletionGoal) ||
|   | ↳ | [androidx.health.connect.client.records.ExerciseCompletionGoal.DistanceAndDurationGoal](https://developer.android.com/reference/androidx/health/connect/client/records/ExerciseCompletionGoal.DistanceAndDurationGoal) |

*** ** * ** ***

An `https://developer.android.com/reference/androidx/health/connect/client/records/ExerciseCompletionGoal` that requires covering a specified distance. Additionally, the step is not complete until the specified time has elapsed. Time remaining after the specified distance has been completed should be spent resting. In the context of swimming, this is sometimes referred to as 'interval training'.

For example, a swimming coach may specify '100m @ 1min40s'. This implies: complete 100m
and if you manage it in 1min30s, you will have 10s of rest prior to the next set.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/health/connect/client/records/ExerciseCompletionGoal.DistanceAndDurationGoal#DistanceAndDurationGoal(androidx.health.connect.client.units.Length,java.time.Duration)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/units/Length distance, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/time/Duration.html duration )` |

| ### Public methods |
|---|---|
| `boolean` | `https://developer.android.com/reference/androidx/health/connect/client/records/ExerciseCompletionGoal.DistanceAndDurationGoal#equals(kotlin.Any)(https://developer.android.com/reference/java/lang/Object.html other)` |
| `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/records/ExerciseCompletionGoal.DistanceAndDurationGoal#getDistance()()` |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/time/Duration.html` | `https://developer.android.com/reference/androidx/health/connect/client/records/ExerciseCompletionGoal.DistanceAndDurationGoal#getDuration()()` |
| `int` | `https://developer.android.com/reference/androidx/health/connect/client/records/ExerciseCompletionGoal.DistanceAndDurationGoal#hashCode()()` |
| `@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/records/ExerciseCompletionGoal.DistanceAndDurationGoal#toString()()` |

## Public constructors

### DistanceAndDurationGoal

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

```
public DistanceAndDurationGoal(
    @NonNull Length distance,
    @NonNull Duration duration
)
```

## Public methods

### equals

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

### getDistance

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

```
public final @NonNull Length getDistance()
```

### getDuration

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

```
public final @NonNull Duration getDuration()
```

### hashCode

```
public int hashCode()
```

### toString

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