# ExerciseGoal

# 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)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/health/services/client/data/ExerciseGoal "View this page in Java")

<br />

```
class ExerciseGoal<T : Number> : Parcelable
```

<br />

*** ** * ** ***

Defines a goal for an exercise.

## Summary

|                                            ### Public companion functions                                             |
|-----------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [ExerciseGoal](https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseGoal)`<T>` | `<T : `[Number](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-number/index.html)`> `[createMilestone](https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseGoal#createMilestone(androidx.health.services.client.data.DataTypeCondition,kotlin.Number))`(` ` condition: `[DataTypeCondition](https://developer.android.com/reference/kotlin/androidx/health/services/client/data/DataTypeCondition)`<T, `[AggregateDataType](https://developer.android.com/reference/kotlin/androidx/health/services/client/data/AggregateDataType)`<T, *>>,` ` period: T` `)` Creates an[ExerciseGoal](https://developer.android.com/reference/kotlin/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.                                        |
| [ExerciseGoal](https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseGoal)`<T>` | `<T : `[Number](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-number/index.html)`> `[createMilestoneGoalWithUpdatedThreshold](https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseGoal#createMilestoneGoalWithUpdatedThreshold(androidx.health.services.client.data.ExerciseGoal,kotlin.Number))`(` ` goal: `[ExerciseGoal](https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseGoal)`<T>,` ` newThreshold: T` `)` Creates a new goal that is the same as a given goal but with a new threshold value.                                                                                                                                                                                                                                                                                             |
| [ExerciseGoal](https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseGoal)`<T>` | `<T : `[Number](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-number/index.html)`> `[createOneTimeGoal](https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseGoal#createOneTimeGoal(androidx.health.services.client.data.DataTypeCondition))`(` ` condition: `[DataTypeCondition](https://developer.android.com/reference/kotlin/androidx/health/services/client/data/DataTypeCondition)`<T, `[AggregateDataType](https://developer.android.com/reference/kotlin/androidx/health/services/client/data/AggregateDataType)`<T, *>>` `)` Creates an[ExerciseGoal](https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseGoal)that is achieved once when the given[DataTypeCondition](https://developer.android.com/reference/kotlin/androidx/health/services/client/data/DataTypeCondition)is satisfied. |

|                                                                                              ### Public companion properties                                                                                              |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------|
| [Parcelable.Creator](https://developer.android.com/reference/android/os/Parcelable.Creator.html)`<`[ExerciseGoal](https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseGoal)`<*>>` | [CREATOR](https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseGoal#CREATOR()) |

|                                        ### Public functions                                         |
|-----------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `open `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                  | [describeContents](https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseGoal#describeContents())`()`                                                                                                                                                                                             |
| `open operator `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | [equals](https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseGoal#equals(kotlin.Any))`(other: `[Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)`?)`                                                                                                                  |
| `open `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                  | [hashCode](https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseGoal#hashCode())`()`                                                                                                                                                                                                             |
| `open `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)            | [toString](https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseGoal#toString())`()`                                                                                                                                                                                                             |
| `open `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                | [writeToParcel](https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseGoal#writeToParcel(android.os.Parcel,kotlin.Int))`(dest: `[Parcel](https://developer.android.com/reference/android/os/Parcel.html)`, flags: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` |

|                                                                                                                        ### Public properties                                                                                                                        |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [DataTypeCondition](https://developer.android.com/reference/kotlin/androidx/health/services/client/data/DataTypeCondition)`<T, `[AggregateDataType](https://developer.android.com/reference/kotlin/androidx/health/services/client/data/AggregateDataType)`<T, *>>` | [dataTypeCondition](https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseGoal#dataTypeCondition())                                                                                                                                                                                                                                                                                                                                        |
| [ExerciseGoalType](https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseGoalType)                                                                                                                                            | [exerciseGoalType](https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseGoal#exerciseGoalType()) The type of this exercise goal ([ExerciseGoalType.ONE_TIME_GOAL](https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseGoalType#ONE_TIME_GOAL())or[ExerciseGoalType.MILESTONE](https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseGoalType#MILESTONE()).) |
| `T?`                                                                                                                                                                                                                                                                | [period](https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseGoal#period())                                                                                                                                                                                                                                                                                                                                                              |

## Public companion functions

### createMilestone

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

```
fun <T : Number> createMilestone(
    condition: DataTypeCondition<T, AggregateDataType<T, *>>,
    period: T
): ExerciseGoal<T>
```

Creates an[ExerciseGoal](https://developer.android.com/reference/kotlin/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)  

```
fun <T : Number> createMilestoneGoalWithUpdatedThreshold(
    goal: ExerciseGoal<T>,
    newThreshold: T
): ExerciseGoal<T>
```

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)  

```
fun <T : Number> createOneTimeGoal(
    condition: DataTypeCondition<T, AggregateDataType<T, *>>
): ExerciseGoal<T>
```

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

## Public companion properties

### CREATOR

```
val CREATOR: Parcelable.Creator<ExerciseGoal<*>>
```  

## Public functions

### describeContents

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

```
open fun describeContents(): Int
```  

### equals

```
open operator fun equals(other: Any?): Boolean
```  

### hashCode

```
open fun hashCode(): Int
```  

### toString

```
open fun toString(): String
```  

### writeToParcel

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

```
open fun writeToParcel(dest: Parcel, flags: Int): Unit
```  

## Public properties

### dataTypeCondition

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

```
val dataTypeCondition: DataTypeCondition<T, AggregateDataType<T, *>>
```  

### exerciseGoalType

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

```
val exerciseGoalType: ExerciseGoalType
```

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

### period

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

```
val period: T?
```