# Enum WorkoutSessionState

java.lang.Object
java.lang.Enum<WorkoutSessionState>
com.codename1.health.workout.WorkoutSessionState

All Implemented Interfaces:
  `Comparable<WorkoutSessionState>`

public enum WorkoutSessionState extends Enum<WorkoutSessionState>

The lifecycle of a `WorkoutSession`.

Transitions are enforced: calling a method that does not apply to the current state fails with `HealthError.SESSION_STATE` rather than silently doing nothing or throwing.

- ## Enum Constant Summary

  Enum Constants
  Enum Constant
  Description
  `ENDED`
  Ended and persisted.
  `FAILED`
  Ended in error, or discarded.
  `NOT_STARTED`
  Created but not yet prepared or started.
  `PAUSED`
  Paused.
  `PREPARING`
  Sensors are warming up.
  `RUNNING`
  Recording.
  `STOPPED`
  Stopping: collection has ceased but the workout has not been written yet.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static WorkoutSessionState`
  `valueOf(String name)`
  Returns the enum constant of this type with the specified name.
  `static WorkoutSessionState[]`
  `values()`
  Returns an array containing the constants of this enum type, in the order they are declared.

  ### Methods inherited from class Enum

  `clone, compareTo, equals, getDeclaringClass, getEnumValues, hashCode, name, ordinal, setEnumValues, toString, valueOf`

  ### Methods inherited from class Object

  `getClass, notify, notifyAll, wait, wait, wait`

- ## Enum Constant Details

  - ### NOT_STARTED

    public static final WorkoutSessionState NOT_STARTED
    Created but not yet prepared or started.

  - ### PREPARING

    public static final WorkoutSessionState PREPARING
    Sensors are warming up. Optional -- see `WorkoutSession.prepare()` -- and worth using if you show a countdown, because heart rate is not immediately available when a session begins.

  - ### RUNNING

    public static final WorkoutSessionState RUNNING
    Recording.

  - ### PAUSED

    public static final WorkoutSessionState PAUSED
    Paused. The elapsed clock stops; wall-clock time keeps passing and is excluded from `WorkoutSession.getElapsedMillis()`.

  - ### STOPPED

    public static final WorkoutSessionState STOPPED
    Stopping: collection has ceased but the workout has not been written yet.

  - ### ENDED

    public static final WorkoutSessionState ENDED
    Ended and persisted.

  - ### FAILED

    public static final WorkoutSessionState FAILED
    Ended in error, or discarded.

- ## Method Details

  - ### values

    public static WorkoutSessionState[] values()
    Returns an array containing the constants of this enum type, in the order they are declared.
    Returns:
      an array containing the constants of this enum type, in the order they are declared

  - ### valueOf

    public static WorkoutSessionState valueOf(String name)
    Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
    Parameters:
      `name` - the name of the enum constant to be returned.
    Returns:
      the enum constant with the specified name
    Throws:
      `IllegalArgumentException` - if this enum type has no constant with the specified name
      `NullPointerException` - if the argument is null