Value | Android Developers

Quicknav Quicknav
Links

- Google Play Developer Console
- Android Developers Blog
- About Android

Android Sites

- Android.com
- Android Developers
- Android Open Source Project

Language
close

- - About
  - Wear
  - TV
  - Auto
- - Get Started
  - Devices
  - Style
  - Patterns
  - Building Blocks
  - Downloads
  - Videos
- - Training
  - API Guides
  - Reference
  - Tools
  - Google Services
  - Samples
- - Google Play
  - Essentials
  - Get Users
  - Engage & Retain
  - Monetize
  - Analyze
  - Tools & Reference
  - Developer Stories

## Results

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

# Value

extends Object
implements Parcelable

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

## Class Overview

Holder object for the value of a single `field` in a `data point`. Values are not constructed directly; a value for each field of the `data type` is created for each data point.

A field value has a particular format, and should be set and read using the format-specific methods. For instance, a float value should be set via `setFloat(float)` and read via `asFloat()`. Formats are defined as constants in `Field`

## Summary

[Expand] Inherited Constants
From interface android.os.Parcelable
int | CONTENTS_FILE_DESCRIPTOR |
int | PARCELABLE_WRITE_RETURN_VALUE |

Fields
public static final Creator<Value> | CREATOR |

Public Methods
String | asActivity() Returns the value of this object as an activity.
float | asFloat() Returns the value of this object as a float.
int | asInt() Returns the value of this object as an int.
int | describeContents()
boolean | equals(Object o)
int | getFormat() Returns the format of this value, which matches the appropriate field in the `data type` definition.
int | hashCode()
boolean | isSet() Returns `true` if this object's value has been set by calling one of the setters.
void | setActivity(String activity) Updates this value object to represent an `activity` value.
void | setFloat(float value) Updates this value object to represent a float value.
void | setInt(int value) Updates this value object to represent an int value.
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()
final void | wait(long arg0, int arg1)
final void | wait(long arg0)
From interface android.os.Parcelable
abstract int | describeContents()
abstract void | writeToParcel(Parcel arg0, int arg1)

## Fields

#### public static final Creator<Value> CREATOR

## Public Methods

#### public String asActivity ()

Returns the value of this object as an activity. The integer representation of the activity is converted to a String prior to returning.

##### Returns

- one of the constants from `FitnessActivities`; `UNKNOWN` if the object does not hold a valid activity representation

##### Throws

IllegalStateException | if the object does not hold an int value

#### public float asFloat ()

Returns the value of this object as a float.

##### Throws

IllegalStateException | if the object does not hold an float value

#### public int asInt ()

Returns the value of this object as an int.

##### Throws

IllegalStateException | if the object does not hold an int value

#### public int describeContents ()

#### public boolean equals (Object o)

#### public int getFormat ()

Returns the format of this value, which matches the appropriate field in the `data type` definition.

##### Returns

- one of the format constants from `Field`

#### public int hashCode ()

#### public boolean isSet ()

Returns `true` if this object's value has been set by calling one of the setters.

#### public void setActivity (String activity)

Updates this value object to represent an `activity` value. Activities are internally represented as integers for storage.

##### Parameters

activity | one of the activities from `FitnessActivities`

#### public void setFloat (float value)

Updates this value object to represent a float value. Any previous values associated with this object are erased.

##### Parameters

value | the new value that this objects holds

#### public void setInt (int value)

Updates this value object to represent an int value. Any previous values are erased.

##### Parameters

value | the new value that this object holds

#### public String toString ()

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