ExerciseSegment
class ExerciseSegment
kotlin.Any | |
↳ | android.health.connect.datatypes.ExerciseSegment |
Represents particular exercise within exercise session (see 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 class for |
Public methods | |
---|---|
Boolean | |
Instant | |
Float |
Gets the rate of perceived exertion (RPE) for this exercise segment. |
Int | |
Int | |
Int |
Gets the set index for this exercise segment. |
Instant | |
Mass? |
Gets the weight associated with this exercise segment. |
Boolean |
Returns true if this segment has an associated rate of perceived exertion. |
Boolean |
Returns true if this segment has an associated set index. |
Int |
hashCode() |
Public methods
equals
fun equals(other: Any?): Boolean
Parameters | |
---|---|
obj |
the reference object with which to compare. |
Return | |
---|---|
Boolean |
true if this object is the same as the obj argument; false otherwise. |
getEndTime
fun getEndTime(): Instant
Return | |
---|---|
Instant |
This value cannot be null . |
getRateOfPerceivedExertion
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
to check whether RPE exists for this segment.
Return | |
---|---|
Float |
Value is between 0.0f and 10.0f inclusive |
Exceptions | |
---|---|
java.lang.IllegalStateException |
if rate of perceived exertion is not set. |
getRepetitionsCount
fun getRepetitionsCount(): Int
Return | |
---|---|
Int |
Value is 0 or greater |
getSegmentType
fun getSegmentType(): Int
getSetIndex
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
to check whether a set index exists for this segment. Multiple segments can share the same set index.
Return | |
---|---|
Int |
Value is 0 or greater |
Exceptions | |
---|---|
java.lang.IllegalStateException |
if set index is not set. |
getStartTime
fun getStartTime(): Instant
Return | |
---|---|
Instant |
This value cannot be null . |
getWeight
fun getWeight(): Mass?
Gets the weight associated with this exercise segment.
Returns null
if weight is not set.
hasRateOfPerceivedExertion
fun hasRateOfPerceivedExertion(): Boolean
Returns true if this segment has an associated rate of perceived exertion.
hasSetIndex
fun hasSetIndex(): Boolean
Returns true if this segment has an associated set index.