LocalValue
Stay organized with collections
Save and categorize content based on your preferences.
Holder object for the value of a single LocalField
in a LocalDataPoint
.
Values are not constructed directly; a value for each field of the LocalDataType
is created for each data point.
A field value has a particular format, and should be read using the format-specific
methods. For instance, a float value should be read via asFloat()
.
Formats are defined as constants in LocalField
Public Method Summary
float |
asFloat
() Returns the value of this object as a float.
|
int |
asInt
() Returns the value of this object as an int.
|
boolean |
|
int |
getFormat
() Returns the format of this value, which matches the appropriate field in the LocalDataType
definition.
|
int |
|
String
|
|
Inherited Method Summary
From class java.lang.Object
Public Methods
public float
asFloat
()
Returns the value of this object as a float.
public int
asInt
()
Returns the value of this object as an int.
public boolean
equals
( Object
other)
Returns the format of this value, which matches the appropriate field in the LocalDataType
definition.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License
, and code samples are licensed under the Apache 2.0 License
. For details, see the Google Developers Site Policies
. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-31 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-10-31 UTC."],[[["\u003cp\u003e\u003ccode\u003eLocalValue\u003c/code\u003e objects store the value of a single field within a fitness data point (\u003ccode\u003eLocalDataPoint\u003c/code\u003e).\u003c/p\u003e\n"],["\u003cp\u003eValues are accessed using format-specific methods like \u003ccode\u003easFloat()\u003c/code\u003e or \u003ccode\u003easInt()\u003c/code\u003e, depending on the field's data type.\u003c/p\u003e\n"],["\u003cp\u003eThe format of the value is determined by the corresponding \u003ccode\u003eLocalField\u003c/code\u003e in the \u003ccode\u003eLocalDataType\u003c/code\u003e definition.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eLocalValue\u003c/code\u003e objects are not directly constructed but are created automatically for each field within a data point.\u003c/p\u003e\n"]]],[],null,["# LocalValue\n\npublic final class **LocalValue** extends [Object](//developer.android.com/reference/java/lang/Object.html) \nHolder object for the value of a single [LocalField](/android/reference/com/google/android/gms/fitness/data/LocalField)\nin a [LocalDataPoint](/android/reference/com/google/android/gms/fitness/data/LocalDataPoint).\nValues are not constructed directly; a value for each field of the [LocalDataType](/android/reference/com/google/android/gms/fitness/data/LocalDataType)\nis created for each data point.\n\nA field value has a particular format, and should be read using the format-specific\nmethods. For instance, a float value should be read via [asFloat()](/android/reference/com/google/android/gms/fitness/data/LocalValue#asFloat()).\nFormats are defined as constants in [LocalField](/android/reference/com/google/android/gms/fitness/data/LocalField) \n\n### Public Method Summary\n\n|-------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| float | [asFloat](/android/reference/com/google/android/gms/fitness/data/LocalValue#asFloat())() Returns the value of this object as a float. |\n| int | [asInt](/android/reference/com/google/android/gms/fitness/data/LocalValue#asInt())() Returns the value of this object as an int. |\n| boolean | [equals](/android/reference/com/google/android/gms/fitness/data/LocalValue#equals(java.lang.Object))([Object](//developer.android.com/reference/java/lang/Object.html) other) |\n| int | [getFormat](/android/reference/com/google/android/gms/fitness/data/LocalValue#getFormat())() Returns the format of this value, which matches the appropriate field in the [LocalDataType](/android/reference/com/google/android/gms/fitness/data/LocalDataType) definition. |\n| int | [hashCode](/android/reference/com/google/android/gms/fitness/data/LocalValue#hashCode())() |\n| [String](//developer.android.com/reference/java/lang/String.html) | [toString](/android/reference/com/google/android/gms/fitness/data/LocalValue#toString())() |\n\n### Inherited Method Summary\n\nFrom class java.lang.Object \n\n|----------------------------------------------------------------------------|--------------------------------------------------------------------------------|\n| [Object](//developer.android.com/reference/java/lang/Object.html) | clone() |\n| boolean | equals([Object](//developer.android.com/reference/java/lang/Object.html) arg0) |\n| void | finalize() |\n| final [Class](//developer.android.com/reference/java/lang/Class.html)\\\u003c?\\\u003e | getClass() |\n| int | hashCode() |\n| final void | notify() |\n| final void | notifyAll() |\n| [String](//developer.android.com/reference/java/lang/String.html) | toString() |\n| final void | wait(long arg0, int arg1) |\n| final void | wait(long arg0) |\n| final void | wait() |\n\nPublic Methods\n--------------\n\n#### public float **asFloat** ()\n\nReturns the value of this object as a float. \n\n##### Throws\n\n| [IllegalStateException](//developer.android.com/reference/java/lang/IllegalStateException.html) | If this [LocalValue](/android/reference/com/google/android/gms/fitness/data/LocalValue) does not correspond to a [LocalField.FORMAT_FLOAT](/android/reference/com/google/android/gms/fitness/data/LocalField#FORMAT_FLOAT) |\n|-------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n\n#### public int **asInt** ()\n\nReturns the value of this object as an int. \n\n##### Throws\n\n| [IllegalStateException](//developer.android.com/reference/java/lang/IllegalStateException.html) | If this [LocalValue](/android/reference/com/google/android/gms/fitness/data/LocalValue) does not correspond to [LocalField.FORMAT_INT32](/android/reference/com/google/android/gms/fitness/data/LocalField#FORMAT_INT32) |\n|-------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n\n#### public boolean **equals** ([Object](//developer.android.com/reference/java/lang/Object.html) other)\n\n#### public int **getFormat** ()\n\nReturns the format of this value, which matches the appropriate field in the\n[LocalDataType](/android/reference/com/google/android/gms/fitness/data/LocalDataType)\ndefinition. \n\n##### Returns\n\n- One of the format constants from [LocalField](/android/reference/com/google/android/gms/fitness/data/LocalField). \n\n#### public int **hashCode** ()\n\n#### public [String](//developer.android.com/reference/java/lang/String.html) **toString** ()"]]