ExerciseSegment.Builder


public static final class ExerciseSegment.Builder
extends Object

java.lang.Object
   ↳ android.health.connect.datatypes.ExerciseSegment.Builder


Builder class for ExerciseSegment

Summary

Public constructors

Builder(Instant startTime, Instant endTime, int segmentType)

Public methods

ExerciseSegment build()

Sets the number repetitions to the current segment.

ExerciseSegment.Builder clearRateOfPerceivedExertion()

Clears the rate of perceived exertion for this exercise segment.

ExerciseSegment.Builder clearSetIndex()

Clears the set index for this exercise segment.

ExerciseSegment.Builder clearWeight()

Clears the weight for this exercise segment.

ExerciseSegment.Builder setRateOfPerceivedExertion(float rateOfPerceivedExertion)

Sets rate of perceived exertion (RPE) used during the exercise segment.

ExerciseSegment.Builder setRepetitionsCount(int repetitionsCount)

Sets the number of repetitions to the current segment.

ExerciseSegment.Builder setSetIndex(int setIndex)

Sets the set index for this exercise segment.

ExerciseSegment.Builder setWeight(Mass weight)

Sets the weight associated with this exercise segment.

Inherited methods

Public constructors

Builder

Added in API level 34
public Builder (Instant startTime, 
                Instant endTime, 
                int segmentType)

Parameters
startTime Instant: This value cannot be null.

endTime Instant: This value cannot be null.

segmentType int: Value is ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_UNKNOWN, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_BARBELL_SHOULDER_PRESS, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_BENCH_SIT_UP, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_BIKING, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_BIKING_STATIONARY, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_DUMBBELL_CURL_LEFT_ARM, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_DUMBBELL_CURL_RIGHT_ARM, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_DUMBBELL_FRONT_RAISE, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_DUMBBELL_LATERAL_RAISE, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_DUMBBELL_TRICEPS_EXTENSION_LEFT_ARM, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_DUMBBELL_TRICEPS_EXTENSION_RIGHT_ARM, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_DUMBBELL_TRICEPS_EXTENSION_TWO_ARM, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_FORWARD_TWIST, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_ELLIPTICAL, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_HIGH_INTENSITY_INTERVAL_TRAINING, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_PILATES, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_ROWING_MACHINE, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_RUNNING, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_RUNNING_TREADMILL, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_STAIR_CLIMBING, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_STAIR_CLIMBING_MACHINE, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_STRETCHING, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_SWIMMING_OPEN_WATER, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_SWIMMING_POOL, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_UPPER_TWIST, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_WALKING, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_WEIGHTLIFTING, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_WHEELCHAIR, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_OTHER_WORKOUT, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_YOGA, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_ARM_CURL, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_BACK_EXTENSION, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_BALL_SLAM, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_BENCH_PRESS, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_BURPEE, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_CRUNCH, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_DEADLIFT, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_DOUBLE_ARM_TRICEPS_EXTENSION, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_DUMBBELL_ROW, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_FRONT_RAISE, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_HIP_THRUST, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_HULA_HOOP, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_JUMPING_JACK, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_JUMP_ROPE, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_KETTLEBELL_SWING, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_LATERAL_RAISE, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_LAT_PULL_DOWN, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_LEG_CURL, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_LEG_EXTENSION, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_LEG_PRESS, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_LEG_RAISE, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_LUNGE, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_MOUNTAIN_CLIMBER, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_PLANK, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_PULL_UP, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_PUNCH, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_SHOULDER_PRESS, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_SINGLE_ARM_TRICEPS_EXTENSION, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_SIT_UP, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_SQUAT, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_SWIMMING_FREESTYLE, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_SWIMMING_BACKSTROKE, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_SWIMMING_BREASTSTROKE, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_SWIMMING_BUTTERFLY, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_SWIMMING_MIXED, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_SWIMMING_OTHER, ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_REST, or ExerciseSegmentType.EXERCISE_SEGMENT_TYPE_PAUSE

Public methods

build

Added in API level 34
public ExerciseSegment build ()

Sets the number repetitions to the current segment. Returns ExerciseSegment instance.

Returns
ExerciseSegment This value cannot be null.

clearRateOfPerceivedExertion

public ExerciseSegment.Builder clearRateOfPerceivedExertion ()

Clears the rate of perceived exertion for this exercise segment.

Returns builder instance with rate of perceived exertion unset.

Returns
ExerciseSegment.Builder This value cannot be null.

clearSetIndex

public ExerciseSegment.Builder clearSetIndex ()

Clears the set index for this exercise segment.

Returns builder instance with set index unset.

Returns
ExerciseSegment.Builder This value cannot be null.

clearWeight

public ExerciseSegment.Builder clearWeight ()

Clears the weight for this exercise segment.

Returns builder instance with weight unset.

Returns
ExerciseSegment.Builder This value cannot be null.

setRateOfPerceivedExertion

public ExerciseSegment.Builder setRateOfPerceivedExertion (float rateOfPerceivedExertion)

Sets rate of perceived exertion (RPE) used during the 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

Returns builder instance with rate of perceived exertion set.

Parameters
rateOfPerceivedExertion float: Value is between 0.0f and 10.0f inclusive

Returns
ExerciseSegment.Builder This value cannot be null.

setRepetitionsCount

Added in API level 34
public ExerciseSegment.Builder setRepetitionsCount (int repetitionsCount)

Sets the number of repetitions to the current segment. Returns builder instance with repetitions count set.

Parameters
repetitionsCount int: Value is 0 or greater

Returns
ExerciseSegment.Builder This value cannot be null.

setSetIndex

public ExerciseSegment.Builder setSetIndex (int setIndex)

Sets the set index for this exercise segment.

The set index must be a non-negative integer, and should start at zero.

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.

Returns builder instance with set index set.

Parameters
setIndex int: Value is 0 or greater

Returns
ExerciseSegment.Builder This value cannot be null.

setWeight

public ExerciseSegment.Builder setWeight (Mass weight)

Sets the weight associated with this exercise segment.

Weight must be at least zero and not more than 2500kg.

Returns builder instance with weight set.

Parameters
weight Mass: This value cannot be null.

Returns
ExerciseSegment.Builder This value cannot be null.