# ExerciseGoal

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

*** ** * ** ***


```
public final class ExerciseGoal<T extends Number> implements Parcelable
```

<br />

*** ** * ** ***

Defines a goal for an exercise.

## Summary

| ### Public fields |
|---|---|
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/os/Parcelable.Creator.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/ExerciseGoal<@https://developer.android.com/reference/androidx/annotation/NonNull ?>>` | `https://developer.android.com/reference/androidx/health/services/client/data/ExerciseGoal#CREATOR()` |

| ### Public methods |
|---|---|
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/ExerciseGoal<@https://developer.android.com/reference/androidx/annotation/NonNull T>` | `<T extends https://developer.android.com/reference/java/lang/Number.html> https://developer.android.com/reference/androidx/health/services/client/data/ExerciseGoal#createMilestone(androidx.health.services.client.data.DataTypeCondition,kotlin.Number)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/DataTypeCondition<@https://developer.android.com/reference/androidx/annotation/NonNull T, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/AggregateDataType<@https://developer.android.com/reference/androidx/annotation/NonNull T, @https://developer.android.com/reference/androidx/annotation/NonNull ?>> condition, @https://developer.android.com/reference/androidx/annotation/NonNull T period )` Creates an `https://developer.android.com/reference/androidx/health/services/client/data/ExerciseGoal` that is achieved multiple times with its threshold being updated by a `period` value each time it is achieved. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/ExerciseGoal<@https://developer.android.com/reference/androidx/annotation/NonNull T>` | `<T extends https://developer.android.com/reference/java/lang/Number.html> https://developer.android.com/reference/androidx/health/services/client/data/ExerciseGoal#createMilestoneGoalWithUpdatedThreshold(androidx.health.services.client.data.ExerciseGoal,kotlin.Number)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/ExerciseGoal<@https://developer.android.com/reference/androidx/annotation/NonNull T> goal, @https://developer.android.com/reference/androidx/annotation/NonNull T newThreshold )` Creates a new goal that is the same as a given goal but with a new threshold value. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/ExerciseGoal<@https://developer.android.com/reference/androidx/annotation/NonNull T>` | `<T extends https://developer.android.com/reference/java/lang/Number.html> https://developer.android.com/reference/androidx/health/services/client/data/ExerciseGoal#createOneTimeGoal(androidx.health.services.client.data.DataTypeCondition)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/DataTypeCondition<@https://developer.android.com/reference/androidx/annotation/NonNull T, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/AggregateDataType<@https://developer.android.com/reference/androidx/annotation/NonNull T, @https://developer.android.com/reference/androidx/annotation/NonNull ?>> condition )` Creates an `https://developer.android.com/reference/androidx/health/services/client/data/ExerciseGoal` that is achieved once when the given `https://developer.android.com/reference/androidx/health/services/client/data/DataTypeCondition` is satisfied. |
| `int` | `https://developer.android.com/reference/androidx/health/services/client/data/ExerciseGoal#describeContents()()` |
| `boolean` | `https://developer.android.com/reference/androidx/health/services/client/data/ExerciseGoal#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/services/client/data/DataTypeCondition<@https://developer.android.com/reference/androidx/annotation/NonNull T, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/AggregateDataType<@https://developer.android.com/reference/androidx/annotation/NonNull T, @https://developer.android.com/reference/androidx/annotation/NonNull ?>>` | `https://developer.android.com/reference/androidx/health/services/client/data/ExerciseGoal#getDataTypeCondition()()` |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/ExerciseGoalType` | `https://developer.android.com/reference/androidx/health/services/client/data/ExerciseGoal#getExerciseGoalType()()` The type of this exercise goal (`https://developer.android.com/reference/androidx/health/services/client/data/ExerciseGoalType#ONE_TIME_GOAL()` or `https://developer.android.com/reference/androidx/health/services/client/data/ExerciseGoalType#MILESTONE()`.) |
| `final T` | `https://developer.android.com/reference/androidx/health/services/client/data/ExerciseGoal#getPeriod()()` |
| `int` | `https://developer.android.com/reference/androidx/health/services/client/data/ExerciseGoal#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/services/client/data/ExerciseGoal#toString()()` |
| `void` | `https://developer.android.com/reference/androidx/health/services/client/data/ExerciseGoal#writeToParcel(android.os.Parcel,kotlin.Int)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/os/Parcel.html dest, int flags)` |

## Public fields

### CREATOR

```
public static final @NonNull Parcelable.Creator<@NonNull ExerciseGoal<@NonNull ?>> CREATOR
```

## Public methods

### createMilestone

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

```
public static final @NonNull ExerciseGoal<@NonNull T> <T extends Number> createMilestone(
    @NonNull DataTypeCondition<@NonNull T, @NonNull AggregateDataType<@NonNull T, @NonNull ?>> condition,
    @NonNull T period
)
```

Creates an `https://developer.android.com/reference/androidx/health/services/client/data/ExerciseGoal` that is achieved multiple times with its threshold being updated by a `period` value each time it is achieved. For instance, a milestone could be one for every 2km. This goal will there be triggered at distances = 2km, 4km, 6km, ...

### createMilestoneGoalWithUpdatedThreshold

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

```
public static final @NonNull ExerciseGoal<@NonNull T> <T extends Number> createMilestoneGoalWithUpdatedThreshold(
    @NonNull ExerciseGoal<@NonNull T> goal,
    @NonNull T newThreshold
)
```

Creates a new goal that is the same as a given goal but with a new threshold value.

### createOneTimeGoal

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

```
public static final @NonNull ExerciseGoal<@NonNull T> <T extends Number> createOneTimeGoal(
    @NonNull DataTypeCondition<@NonNull T, @NonNull AggregateDataType<@NonNull T, @NonNull ?>> condition
)
```

Creates an `https://developer.android.com/reference/androidx/health/services/client/data/ExerciseGoal` that is achieved once when the given `https://developer.android.com/reference/androidx/health/services/client/data/DataTypeCondition` is satisfied.

### describeContents

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

```
public int describeContents()
```

### equals

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

### getDataTypeCondition

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

```
public final @NonNull DataTypeCondition<@NonNull T, @NonNull AggregateDataType<@NonNull T, @NonNull ?>> getDataTypeCondition()
```

### getExerciseGoalType

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

```
public final @NonNull ExerciseGoalType getExerciseGoalType()
```

The type of this exercise goal (`https://developer.android.com/reference/androidx/health/services/client/data/ExerciseGoalType#ONE_TIME_GOAL()` or `https://developer.android.com/reference/androidx/health/services/client/data/ExerciseGoalType#MILESTONE()`.)

### getPeriod

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

```
public final T getPeriod()
```

### hashCode

```
public int hashCode()
```

### toString

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

### writeToParcel

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

```
public void writeToParcel(@NonNull Parcel dest, int flags)
```