# ExerciseSegment

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# ExerciseSegment

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/health/connect/datatypes/ExerciseSegment "View this page in Java")  

```
class ExerciseSegment
```

|---|------------------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                                       ||
| ↳ | [android.health.connect.datatypes.ExerciseSegment](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegment#) |

Represents particular exercise within exercise session (see[ExerciseSessionRecord](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSessionRecord)).

Each record contains start and end time of the exercise, exercise type and optional number of repetitions, weight, set index and rate of perceived exertion.

## Summary

|                                                                                                                       Nested classes                                                                                                                       ||
|---|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|   | [Builder](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegment.Builder) Builder class for[ExerciseSegment](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegment#) |

|                                                                                                                                                                 Public methods                                                                                                                                                                 ||
|-----------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)                  | [equals](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegment#equals(kotlin.Any))`(`other:` `[Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)?`)` <br />             |
| [Instant](https://developer.android.com/reference/kotlin/java/time/Instant.html#)                   | [getEndTime](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegment#getEndTime())`()` <br />                                                                                                     |
| [Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html)                      | [getRateOfPerceivedExertion](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegment#getRateOfPerceivedExertion())`()` Gets the rate of perceived exertion (RPE) for this exercise segment.       |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)                          | [getRepetitionsCount](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegment#getRepetitionsCount())`()` <br />                                                                                   |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)                          | [getSegmentType](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegment#getSegmentType())`()` <br />                                                                                             |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)                          | [getSetIndex](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegment#getSetIndex())`()` Gets the set index for this exercise segment.                                                            |
| [Instant](https://developer.android.com/reference/kotlin/java/time/Instant.html#)                   | [getStartTime](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegment#getStartTime())`()` <br />                                                                                                 |
| [Mass](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/units/Mass)? | [getWeight](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegment#getWeight())`()` Gets the weight associated with this exercise segment.                                                       |
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)                  | [hasRateOfPerceivedExertion](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegment#hasRateOfPerceivedExertion())`()` Returns true if this segment has an associated rate of perceived exertion. |
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)                  | [hasSetIndex](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegment#hasSetIndex())`()` Returns true if this segment has an associated set index.                                                |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)                          | [hashCode](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegment#hashCode())`()` <br />                                                                                                         |

## Public methods

### equals

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

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

|                     Parameters                     ||
|-------|---------------------------------------------|
| `obj` | the reference object with which to compare. |

|                                                                           Return                                                                           ||
|------------------------------------------------------------------------------------|------------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `true`if this object is the same as the obj argument;`false`otherwise. |

### getEndTime

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getEndTime(): Instant
```

|                                                     Return                                                     ||
|-----------------------------------------------------------------------------------|-----------------------------|
| [Instant](https://developer.android.com/reference/kotlin/java/time/Instant.html#) | This value cannot be`null`. |

### getRateOfPerceivedExertion

Added in[API level 36.1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getRateOfPerceivedExertion(): Float
```

Gets the rate of perceived exertion (RPE) for this exercise segment.

Values correspond to the Borg CR10 RPE scale and must be in the range 0 to 10 inclusive. 0: No exertion (at rest) 1: Very light 2-3: Light 4-5: Moderate 6-7: Hard 8-9: Very hard 10: Maximum effort

Use[hasRateOfPerceivedExertion](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegment#hasRateOfPerceivedExertion())to check whether RPE exists for this segment.

|                                                          Return                                                           ||
|--------------------------------------------------------------------------------|-------------------------------------------|
| [Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html) | Value is between 0.0f and 10.0f inclusive |

|                                  Exceptions                                  ||
|-----------------------------------|-------------------------------------------|
| `java.lang.IllegalStateException` | if rate of perceived exertion is not set. |

### getRepetitionsCount

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getRepetitionsCount(): Int
```

|                                              Return                                               ||
|----------------------------------------------------------------------------|-----------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | Value is 0 or greater |

### getSegmentType

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getSegmentType(): Int
```

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     Return                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     ||
|----------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | Value is[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_UNKNOWN](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_UNKNOWN:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_BARBELL_SHOULDER_PRESS](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_BARBELL_SHOULDER_PRESS:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_BENCH_SIT_UP](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_BENCH_SIT_UP:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_BIKING](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_BIKING:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_BIKING_STATIONARY](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_BIKING_STATIONARY:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_DUMBBELL_CURL_LEFT_ARM](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_DUMBBELL_CURL_LEFT_ARM:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_DUMBBELL_CURL_RIGHT_ARM](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_DUMBBELL_CURL_RIGHT_ARM:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_DUMBBELL_FRONT_RAISE](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_DUMBBELL_FRONT_RAISE:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_DUMBBELL_LATERAL_RAISE](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_DUMBBELL_LATERAL_RAISE:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_DUMBBELL_TRICEPS_EXTENSION_LEFT_ARM](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_DUMBBELL_TRICEPS_EXTENSION_LEFT_ARM:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_DUMBBELL_TRICEPS_EXTENSION_RIGHT_ARM](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_DUMBBELL_TRICEPS_EXTENSION_RIGHT_ARM:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_DUMBBELL_TRICEPS_EXTENSION_TWO_ARM](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_DUMBBELL_TRICEPS_EXTENSION_TWO_ARM:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_FORWARD_TWIST](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_FORWARD_TWIST:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_ELLIPTICAL](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_ELLIPTICAL:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_HIGH_INTENSITY_INTERVAL_TRAINING](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_HIGH_INTENSITY_INTERVAL_TRAINING:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_PILATES](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_PILATES:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_ROWING_MACHINE](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_ROWING_MACHINE:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_RUNNING](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_RUNNING:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_RUNNING_TREADMILL](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_RUNNING_TREADMILL:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_STAIR_CLIMBING](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_STAIR_CLIMBING:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_STAIR_CLIMBING_MACHINE](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_STAIR_CLIMBING_MACHINE:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_STRETCHING](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_STRETCHING:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_SWIMMING_OPEN_WATER](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_SWIMMING_OPEN_WATER:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_SWIMMING_POOL](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_SWIMMING_POOL:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_UPPER_TWIST](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_UPPER_TWIST:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_WALKING](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_WALKING:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_WEIGHTLIFTING](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_WEIGHTLIFTING:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_WHEELCHAIR](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_WHEELCHAIR:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_OTHER_WORKOUT](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_OTHER_WORKOUT:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_YOGA](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_YOGA:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_ARM_CURL](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_ARM_CURL:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_BACK_EXTENSION](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_BACK_EXTENSION:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_BALL_SLAM](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_BALL_SLAM:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_BENCH_PRESS](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_BENCH_PRESS:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_BURPEE](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_BURPEE:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_CRUNCH](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_CRUNCH:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_DEADLIFT](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_DEADLIFT:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_DOUBLE_ARM_TRICEPS_EXTENSION](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_DOUBLE_ARM_TRICEPS_EXTENSION:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_DUMBBELL_ROW](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_DUMBBELL_ROW:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_FRONT_RAISE](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_FRONT_RAISE:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_HIP_THRUST](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_HIP_THRUST:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_HULA_HOOP](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_HULA_HOOP:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_JUMPING_JACK](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_JUMPING_JACK:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_JUMP_ROPE](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_JUMP_ROPE:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_KETTLEBELL_SWING](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_KETTLEBELL_SWING:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_LATERAL_RAISE](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_LATERAL_RAISE:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_LAT_PULL_DOWN](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_LAT_PULL_DOWN:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_LEG_CURL](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_LEG_CURL:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_LEG_EXTENSION](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_LEG_EXTENSION:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_LEG_PRESS](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_LEG_PRESS:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_LEG_RAISE](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_LEG_RAISE:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_LUNGE](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_LUNGE:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_MOUNTAIN_CLIMBER](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_MOUNTAIN_CLIMBER:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_PLANK](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_PLANK:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_PULL_UP](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_PULL_UP:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_PUNCH](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_PUNCH:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_SHOULDER_PRESS](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_SHOULDER_PRESS:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_SINGLE_ARM_TRICEPS_EXTENSION](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_SINGLE_ARM_TRICEPS_EXTENSION:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_SIT_UP](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_SIT_UP:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_SQUAT](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_SQUAT:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_SWIMMING_FREESTYLE](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_SWIMMING_FREESTYLE:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_SWIMMING_BACKSTROKE](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_SWIMMING_BACKSTROKE:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_SWIMMING_BREASTSTROKE](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_SWIMMING_BREASTSTROKE:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_SWIMMING_BUTTERFLY](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_SWIMMING_BUTTERFLY:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_SWIMMING_MIXED](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_SWIMMING_MIXED:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_SWIMMING_OTHER](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_SWIMMING_OTHER:kotlin.Int),[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_REST](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_REST:kotlin.Int), or[android.health.connect.datatypes.ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_PAUSE](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegmentType#EXERCISE_SEGMENT_TYPE_PAUSE:kotlin.Int) |

### getSetIndex

Added in[API level 36.1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getSetIndex(): Int
```

Gets the set index for this exercise segment.

The set index is a non-negative integer starting at zero.

A set is a group of consecutive repetitions (reps) of a specific exercise performed without a break, e.g. 10 push-ups in a row without stopping.

A set index represents the position of this set relative to other sets in the session. For instance, if an exercise has three sets, they will have setIndex values of 0, 1, and 2 respectively.

Multiple segments may be part of a single set, for example if a collection of activities are considered to be a single set, in which case those segments would have the same set index.

The set index is may also go back to zero in a single`ExerciseSession`. For example, if three sets of one activity are completed followed by three sets of another, setIndex values of 0, 1, 2, 0, 1, 2 would be expected for those segments.

Use[hasSetIndex](https://developer.android.com/reference/kotlin/android/health/connect/datatypes/ExerciseSegment#hasSetIndex())to check whether a set index exists for this segment. Multiple segments can share the same set index.

|                                              Return                                               ||
|----------------------------------------------------------------------------|-----------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | Value is 0 or greater |

|                         Exceptions                          ||
|-----------------------------------|--------------------------|
| `java.lang.IllegalStateException` | if set index is not set. |

### getStartTime

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getStartTime(): Instant
```

|                                                     Return                                                     ||
|-----------------------------------------------------------------------------------|-----------------------------|
| [Instant](https://developer.android.com/reference/kotlin/java/time/Instant.html#) | This value cannot be`null`. |

### getWeight

Added in[API level 36.1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getWeight(): Mass?
```

Gets the weight associated with this exercise segment.

Returns`null`if weight is not set.  

### hasRateOfPerceivedExertion

Added in[API level 36.1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun hasRateOfPerceivedExertion(): Boolean
```

Returns true if this segment has an associated rate of perceived exertion.  

### hasSetIndex

Added in[API level 36.1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun hasSetIndex(): Boolean
```

Returns true if this segment has an associated set index.  

### hashCode

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

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

|                                                     Return                                                     ||
|----------------------------------------------------------------------------|------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | a hash code value for this object. |