DataPoint.Builder

public static classDataPoint.BuilderextendsObject

Builder forDataPoint instances.

Public Method Summary

DataPoint
build()
Builds and returns theDataPoint.
DataPoint.Builder
setActivityField(Field field,Stringactivity)
Sets the value of an activity field toactivity.
DataPoint.Builder
setField(Field field, float value)
Sets the floating point value of the givenfieldto value.
DataPoint.Builder
setField(Field field,Map<String,Float> value)
Sets the map value of the givenfieldtovalue.
DataPoint.Builder
setField(Field field, int value)
Sets the integer value of the givenfieldtovalue.
DataPoint.Builder
setField(Field field,Stringvalue)
Sets the string value of the givenfieldtovalue.
DataPoint.Builder
setFloatValues(float... values)
Sets the values of the data point, where the format for all of its values is float.
DataPoint.Builder
setIntValues(int... values)
Sets the values of the data point, where the format for all of its values is int.
DataPoint.Builder
setTimeInterval(long startTime, long endTime,TimeUnit timeUnit)
Sets the time interval of a data point that represents an interval of time.
DataPoint.Builder
setTimestamp(long timestamp,TimeUnit timeUnit)
Sets the timestamp of a data point that represent an instantaneous reading, measurement, or input.

Inherited Method Summary

Public Methods

publicDataPoint build()

Builds and returns theDataPoint.

publicDataPoint.Builder setActivityField(Field field,String activity)

Sets the value of an activity field toactivity.

Throws
IllegalArgumentException If the given index is out of the range for this data type.
IllegalStateException If the field isn't of formatField.FORMAT_INT32.

publicDataPoint.Builder setField(Fieldfield, float value)

Sets the floating point value of the givenfieldto value.

Throws
IllegalArgumentException If the given index is out of the range for this data type.
IllegalStateException If the field isn't of formatField.FORMAT_FLOAT.

publicDataPoint.Builder setField(Fieldfield, Map<String,Float> value)

Sets the map value of the givenfieldtovalue.

Throws
IllegalArgumentException If the given index is out of the range for this data type.
IllegalStateException If the field isn't of formatField.FORMAT_MAP.

publicDataPoint.Builder setField(Fieldfield, int value)

Sets the integer value of the givenfieldtovalue.

Throws
IllegalArgumentException If the given index is out of the range for this data type.
IllegalStateException If the field isn't of formatField.FORMAT_INT32.

publicDataPoint.Builder setField(Fieldfield, String value)

Sets the string value of the givenfieldtovalue.

Throws
IllegalArgumentException If the given index is out of the range for this data type.
IllegalStateException If the field isn't of formatField.FORMAT_STRING.

publicDataPoint.Builder setFloatValues(float... values)

Sets the values of the data point, where the format for all of its values is float.

Parameters
values The value for each field of the data point, in order.

publicDataPoint.Builder setIntValues(int... values)

Sets the values of the data point, where the format for all of its values is int.

Parameters
values The value for each field of the data point, in order.

publicDataPoint.Builder setTimeInterval(long startTime, long endTime,TimeUnit timeUnit)

Sets the time interval of a data point that represents an interval of time. For data points that represent instantaneous readings, setTimestamp(long, TimeUnit)should be used.

Examples of data types that represent intervals include:

Google Fit accepts timestamps with up to nanosecond granularity.
Parameters
startTime The start time in the given unit, representing elapsed time since epoch.
endTime The end time in the given unit, representing elapsed time since epoch.
timeUnit The time unit of both start and end timestamps.

publicDataPoint.Builder setTimestamp(long timestamp,TimeUnit timeUnit)

Sets the timestamp of a data point that represent an instantaneous reading, measurement, or input. For data points that represent intervals, setTimeInterval(long, long, TimeUnit)should be used.

Examples of data types with instantaneous timestamp include:

Google Fit accepts timestamps with up to nanosecond granularity for all DataTypes.
Parameters
timestamp The timestamp in the given unit, representing elapsed time since epoch.
timeUnit The unit of the given timestamp.