Summary: Constants | Inherited Constants | Fields | Methods | Inherited Methods | [Expand All]
public final class

# Field

extends Object
implements SafeParcelable

java.lang.Object
↳ | com.google.android.gms.fitness.data.Field

## Class Overview

A field represents one dimension of a data type. It defines the name and format of data. Unlike data type names, field names are not namespaced, and only need to be unique within the data type.

This class contains constants representing the field names of common data types, each prefixed with `FIELD_`. These can be used to access and set the fields via `DataPoint.getValue(Field)`.

Fields for custom data types can be created using `addField(String, int)`.

## Summary

Constants
int | FORMAT_FLOAT | Format constant indicating the field holds float values.
int | FORMAT_INT32 | Format constant indicating the field holds integer values.
int | FORMAT_MAP | Format constant indicating the field holds a map of string keys to values.
int | FORMAT_STRING | Format constant indicating the field holds string values.
int | MEAL_TYPE_BREAKFAST | Meal type constant representing a breakfast meal.
int | MEAL_TYPE_DINNER | Meal type constant representing a dinner meal.
int | MEAL_TYPE_LUNCH | Meal type constant representing a lunch meal.
int | MEAL_TYPE_SNACK | Meal type constant representing a snack meal.
int | MEAL_TYPE_UNKNOWN | Meal type constant representing that the meal type is unknown.
String | NUTRIENT_CALCIUM | Calcium amount in milligrams.
String | NUTRIENT_CALORIES | Calories in kcal.
String | NUTRIENT_CHOLESTEROL | Cholesterol in milligrams.
String | NUTRIENT_DIETARY_FIBER | Dietary fiber in grams.
String | NUTRIENT_IRON | Iron amount in milligrams.
String | NUTRIENT_MONOUNSATURATED_FAT | Monounsaturated fat in grams.
String | NUTRIENT_POLYUNSATURATED_FAT | Polyunsaturated fat in grams.
String | NUTRIENT_POTASSIUM | Potassium in milligrams.
String | NUTRIENT_PROTEIN | Protein amount in grams.
String | NUTRIENT_SATURATED_FAT | Saturated fat in grams.
String | NUTRIENT_SODIUM | Sodium in milligrams.
String | NUTRIENT_SUGAR | Sugar amount in grams.
String | NUTRIENT_TOTAL_CARBS | Total carbohydrates in grams.
String | NUTRIENT_TOTAL_FAT | Total fat in grams.
String | NUTRIENT_TRANS_FAT | Trans fat in grams.
String | NUTRIENT_UNSATURATED_FAT | Unsaturated fat in grams.
String | NUTRIENT_VITAMIN_A | Vitamin A amount in International Units (IU).
String | NUTRIENT_VITAMIN_C | Vitamin C amount in milligrams.
int | RESISTANCE_TYPE_BARBELL | The user is using a barbell for resistance.
int | RESISTANCE_TYPE_BODY | The user is using their own body weight for resistance.
int | RESISTANCE_TYPE_CABLE | The user is using a cable for resistance.
int | RESISTANCE_TYPE_DUMBBELL | The user is using dumbells for resistance.
int | RESISTANCE_TYPE_KETTLEBELL | The user is using a kettlebell for resistance.
int | RESISTANCE_TYPE_MACHINE | The user is performing the exercise in a machine.
int | RESISTANCE_TYPE_UNKNOWN | The resistance type is unknown, unspecified, or not represented by any canonical values.

[Expand] Inherited Constants
From interface com.google.android.gms.common.internal.safeparcel.SafeParcelable
String | NULL |
From interface android.os.Parcelable
int | CONTENTS_FILE_DESCRIPTOR |
int | PARCELABLE_WRITE_RETURN_VALUE |

Fields
public static final Field | FIELD_ACCURACY | The accuracy of an accompanied value (such as location).
public static final Field | FIELD_ACTIVITY | An activity type of `FitnessActivities`, encoded as an integer for efficiency.
public static final Field | FIELD_ALTITUDE | An altitude of a location represented as a float, in meters above sea level.
public static final Field | FIELD_AVERAGE | An average value.
public static final Field | FIELD_BPM | A heart rate in beats per minute.
public static final Field | FIELD_CALORIES | Calories in kcal.
public static final Field | FIELD_CIRCUMFERENCE | Circumference of a body part, in centimeters.
public static final Field | FIELD_CONFIDENCE | The confidence of an accompanied value, specified as a value between 0.0 and 100.0.
public static final Field | FIELD_DISTANCE | A distance in meters.
public static final Field | FIELD_DURATION | A duration in milliseconds.
public static final Field | FIELD_EXERCISE | A workout exercise, as represented by one of the constants in `WorkoutExercises`.
public static final Field | FIELD_FOOD_ITEM | The corresponding food item for a nutrition entry.
public static final Field | FIELD_HEIGHT | A height in meters.
public static final Field | FIELD_HIGH_LATITUDE | A high latitude of a location bounding box represented as a float, in degrees.
public static final Field | FIELD_HIGH_LONGITUDE | A high longitude of a location bounding box represented as a float, in degrees.
public static final Field | FIELD_LATITUDE | A latitude of a location represented as a float, in degrees.
public static final Field | FIELD_LONGITUDE | A longitude of a location represented as a float, in degrees.
public static final Field | FIELD_LOW_LATITUDE | A low latitude of a location bounding box represented as a float, in degrees.
public static final Field | FIELD_LOW_LONGITUDE | A low longitude of a location bounding box represented as a float, in degrees.
public static final Field | FIELD_MAX | A maximum value.
public static final Field | FIELD_MEAL_TYPE | Type of meal, represented as the appropriate int constant.
public static final Field | FIELD_MIN | A minimum value.
public static final Field | FIELD_NUM_SEGMENTS | A number of segments.
public static final Field | FIELD_NUTRIENTS | Nutrients ingested by the user, represented as a float map of nutrient key to quantity.
public static final Field | FIELD_PERCENTAGE | A percentage value, between 0 and 100.
public static final Field | FIELD_REPETITIONS | A count of repetitions for a single set of a workout exercise.
public static final Field | FIELD_RESISTANCE | The resistance of the exercise (or weight), in kg.
public static final Field | FIELD_RESISTANCE_TYPE | The type of resistance used in this exercise, represented as the appropriate int constant.
public static final Field | FIELD_REVOLUTIONS | A count of revolutions.
public static final Field | FIELD_RPM | Revolutions per minute or rate per minute.
public static final Field | FIELD_SPEED | A speed in meter/sec.
public static final Field | FIELD_STEPS | A count of steps.
public static final Field | FIELD_VOLUME | Volume in liters.
public static final Field | FIELD_WATTS | Power in watts.
public static final Field | FIELD_WEIGHT | A weight in kilograms.

Public Methods
boolean | equals(Object that)
int | getFormat() Returns the format of the field, as one of the format constant values.
String | getName() Returns the name of the field.
int | hashCode()
Boolean | isOptional()
String | toString()
void | writeToParcel(Parcel dest, int flags)

[Expand] Inherited Methods
From class java.lang.Object
Object | clone()
boolean | equals(Object arg0)
void | finalize()
final Class<?> | getClass()
int | hashCode()
final void | notify()
final void | notifyAll()
String | toString()
final void | wait(long arg0, int arg1)
final void | wait(long arg0)
final void | wait()
From interface android.os.Parcelable
abstract int | describeContents()
abstract void | writeToParcel(Parcel arg0, int arg1)

## Constants

#### public static final int FORMAT_FLOAT

Format constant indicating the field holds float values.

Constant Value: 2 (0x00000002)

#### public static final int FORMAT_INT32

Format constant indicating the field holds integer values.

Constant Value: 1 (0x00000001)

#### public static final int FORMAT_MAP

Format constant indicating the field holds a map of string keys to values. The valid key space and units for the corresponding value should be documented as part of the data type definition.

Map values can be set using `setKeyValue(String, float)` and read using `getKeyValue(String)`.

Keys should be kept small whenever possible. Data streams with large keys and high data frequency may be down sampled.

Constant Value: 4 (0x00000004)

#### public static final int FORMAT_STRING

Format constant indicating the field holds string values. Strings should be kept small whenever possible. Data streams with large string values and high data frequency may be down sampled.

Constant Value: 3 (0x00000003)

#### public static final int MEAL_TYPE_BREAKFAST

Meal type constant representing a breakfast meal.

Constant Value: 1 (0x00000001)

#### public static final int MEAL_TYPE_DINNER

Meal type constant representing a dinner meal.

Constant Value: 3 (0x00000003)

#### public static final int MEAL_TYPE_LUNCH

Meal type constant representing a lunch meal.

Constant Value: 2 (0x00000002)

#### public static final int MEAL_TYPE_SNACK

Meal type constant representing a snack meal.

Constant Value: 4 (0x00000004)

#### public static final int MEAL_TYPE_UNKNOWN

Meal type constant representing that the meal type is unknown.

Constant Value: 0 (0x00000000)

#### public static final String NUTRIENT_CALCIUM

Calcium amount in milligrams.

Constant Value: "calcium"

#### public static final String NUTRIENT_CALORIES

Calories in kcal.

Constant Value: "calories"

#### public static final String NUTRIENT_CHOLESTEROL

Cholesterol in milligrams.

Constant Value: "cholesterol"

#### public static final String NUTRIENT_DIETARY_FIBER

Dietary fiber in grams.

Constant Value: "dietary_fiber"

#### public static final String NUTRIENT_IRON

Iron amount in milligrams.

Constant Value: "iron"

#### public static final String NUTRIENT_MONOUNSATURATED_FAT

Monounsaturated fat in grams.

Constant Value: "fat.monounsaturated"

#### public static final String NUTRIENT_POLYUNSATURATED_FAT

Polyunsaturated fat in grams.

Constant Value: "fat.polyunsaturated"

#### public static final String NUTRIENT_POTASSIUM

Potassium in milligrams.

Constant Value: "potassium"

#### public static final String NUTRIENT_PROTEIN

Protein amount in grams.

Constant Value: "protein"

#### public static final String NUTRIENT_SATURATED_FAT

Saturated fat in grams.

Constant Value: "fat.saturated"

#### public static final String NUTRIENT_SODIUM

Sodium in milligrams.

Constant Value: "sodium"

#### public static final String NUTRIENT_SUGAR

Sugar amount in grams.

Constant Value: "sugar"

#### public static final String NUTRIENT_TOTAL_CARBS

Total carbohydrates in grams.

Constant Value: "carbs.total"

#### public static final String NUTRIENT_TOTAL_FAT

Total fat in grams.

Constant Value: "fat.total"

#### public static final String NUTRIENT_TRANS_FAT

Trans fat in grams.

Constant Value: "fat.trans"

#### public static final String NUTRIENT_UNSATURATED_FAT

Unsaturated fat in grams.

Constant Value: "fat.unsaturated"

#### public static final String NUTRIENT_VITAMIN_A

Vitamin A amount in International Units (IU). For converting from daily percentages, the FDA recommended 5000 IUs Daily Value can be used.

Constant Value: "vitamin_a"

#### public static final String NUTRIENT_VITAMIN_C

Vitamin C amount in milligrams.

Constant Value: "vitamin_c"

#### public static final int RESISTANCE_TYPE_BARBELL

The user is using a barbell for resistance. The specified resistance should include the weight of the bar, as well as weights added to both sides.

Constant Value: 1 (0x00000001)

#### public static final int RESISTANCE_TYPE_BODY

The user is using their own body weight for resistance.

Constant Value: 6 (0x00000006)

#### public static final int RESISTANCE_TYPE_CABLE

The user is using a cable for resistance. When two cables are being used (one for each arm), the specified resistance should include the weight being pulled by one cable.

Constant Value: 2 (0x00000002)

#### public static final int RESISTANCE_TYPE_DUMBBELL

The user is using dumbells for resistance. The specified resistance should include the weight of a single dumbell.

Constant Value: 3 (0x00000003)

#### public static final int RESISTANCE_TYPE_KETTLEBELL

The user is using a kettlebell for resistance.

Constant Value: 4 (0x00000004)

#### public static final int RESISTANCE_TYPE_MACHINE

The user is performing the exercise in a machine. The specified resistance should match the weight specified by the machine.

Constant Value: 5 (0x00000005)

#### public static final int RESISTANCE_TYPE_UNKNOWN

The resistance type is unknown, unspecified, or not represented by any canonical values.

Constant Value: 0 (0x00000000)

## Fields

#### public static final Field FIELD_ACCURACY

The accuracy of an accompanied value (such as location).

#### public static final Field FIELD_ACTIVITY

An activity type of `FitnessActivities`, encoded as an integer for efficiency. The activity value should be stored using `setActivity(String)`, and read using `asActivity()`

#### public static final Field FIELD_ALTITUDE

An altitude of a location represented as a float, in meters above sea level. Some location samples don't have an altitude value so this field might not be set.

#### public static final Field FIELD_AVERAGE

An average value.

#### public static final Field FIELD_BPM

A heart rate in beats per minute.

#### public static final Field FIELD_CALORIES

Calories in kcal.

#### public static final Field FIELD_CIRCUMFERENCE

Circumference of a body part, in centimeters.

#### public static final Field FIELD_CONFIDENCE

The confidence of an accompanied value, specified as a value between 0.0 and 100.0.

#### public static final Field FIELD_DISTANCE

A distance in meters.

#### public static final Field FIELD_DURATION

A duration in milliseconds.

#### public static final Field FIELD_EXERCISE

A workout exercise, as represented by one of the constants in `WorkoutExercises`.

#### public static final Field FIELD_FOOD_ITEM

The corresponding food item for a nutrition entry.

#### public static final Field FIELD_HEIGHT

A height in meters.

#### public static final Field FIELD_HIGH_LATITUDE

A high latitude of a location bounding box represented as a float, in degrees.

#### public static final Field FIELD_HIGH_LONGITUDE

A high longitude of a location bounding box represented as a float, in degrees.

#### public static final Field FIELD_LATITUDE

A latitude of a location represented as a float, in degrees.

#### public static final Field FIELD_LONGITUDE

A longitude of a location represented as a float, in degrees.

#### public static final Field FIELD_LOW_LATITUDE

A low latitude of a location bounding box represented as a float, in degrees.

#### public static final Field FIELD_LOW_LONGITUDE

A low longitude of a location bounding box represented as a float, in degrees.

#### public static final Field FIELD_MAX

A maximum value.

#### public static final Field FIELD_MEAL_TYPE

Type of meal, represented as the appropriate int constant.

#### public static final Field FIELD_MIN

A minimum value.

#### public static final Field FIELD_NUM_SEGMENTS

A number of segments.

#### public static final Field FIELD_NUTRIENTS

Nutrients ingested by the user, represented as a float map of nutrient key to quantity. The valid keys of the map are listed in this class using the `NUTRIENT_` prefix. The documentation for each key describes the unit of its value.

#### public static final Field FIELD_PERCENTAGE

A percentage value, between 0 and 100.

#### public static final Field FIELD_REPETITIONS

A count of repetitions for a single set of a workout exercise.

#### public static final Field FIELD_RESISTANCE

The resistance of the exercise (or weight), in kg.

#### public static final Field FIELD_RESISTANCE_TYPE

The type of resistance used in this exercise, represented as the appropriate int constant.

#### public static final Field FIELD_REVOLUTIONS

A count of revolutions.

#### public static final Field FIELD_RPM

Revolutions per minute or rate per minute.

#### public static final Field FIELD_SPEED

A speed in meter/sec.

#### public static final Field FIELD_STEPS

A count of steps.

#### public static final Field FIELD_VOLUME

Volume in liters.

#### public static final Field FIELD_WATTS

Power in watts.

#### public static final Field FIELD_WEIGHT

A weight in kilograms.

## Public Methods

#### public boolean equals (Object that)

#### public int getFormat ()

Returns the format of the field, as one of the format constant values.

#### public String getName ()

Returns the name of the field.

#### public int hashCode ()

#### public Boolean isOptional ()

#### public String toString ()

#### public void writeToParcel (Parcel dest, int flags)