public final class

Field

extends Object
implements Parcelable
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 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_VITAMIN_A Vitamin A amount in International Units (IU).
String NUTRIENT_VITAMIN_C Vitamin C amount in milligrams.
[Expand]
Inherited Constants
From interface android.os.Parcelable
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_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_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_WATTS Power in watts.
public static final Field FIELD_WEIGHT A weight in kilograms.
Public Methods
int describeContents()
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()
String toString()
void writeToParcel(Parcel dest, int flags)
[Expand]
Inherited Methods
From class java.lang.Object
From interface android.os.Parcelable

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 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_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"

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_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_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_WATTS

Power in watts.

public static final Field FIELD_WEIGHT

A weight in kilograms.

Public Methods

public int describeContents ()

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 String toString ()

public void writeToParcel (Parcel dest, int flags)