AlcoholConsumptionRecord.Builder


public static final class AlcoholConsumptionRecord.Builder
extends Object

java.lang.Object
   ↳ android.health.connect.datatypes.AlcoholConsumptionRecord.Builder


Builder class for AlcoholConsumptionRecord

Summary

Public constructors

Builder(Metadata metadata, Instant time, int beverageType)

Builder for an alcohol consumption record that occurs at a specific instant in time.

Builder(Metadata metadata, Instant startTime, Instant endTime, int beverageType)

Builder for an alcohol consumption record that occurs over a time interval.

Builder(Metadata metadata, LocalDate date, int beverageType)

Builder for an alcohol consumption record that occurs on a specific date.

Public methods

AlcoholConsumptionRecord build()
AlcoholConsumptionRecord.Builder clearEndZoneOffset()

Clears the zone offset of the user when the activity was logged.

AlcoholConsumptionRecord.Builder clearStartZoneOffset()

Clears the zone offset of the user when the activity was logged.

AlcoholConsumptionRecord.Builder setAlcoholByVolume(Percentage alcoholByVolume)

Sets the alcohol by volume of the beverage.

AlcoholConsumptionRecord.Builder setBeverageType(int beverageType)

Sets the type of beverage the user consumed.

AlcoholConsumptionRecord.Builder setEndZoneOffset(ZoneOffset endZoneOffset)

Sets the zone offset of the user when the activity was logged.

AlcoholConsumptionRecord.Builder setNotes(CharSequence notes)

Sets the notes for this record.

AlcoholConsumptionRecord.Builder setServingVolume(Volume servingVolume)

Sets the volume of a single serving consumed.

AlcoholConsumptionRecord.Builder setStartZoneOffset(ZoneOffset startZoneOffset)

Sets the zone offset of the user when the activity was logged.

Inherited methods

Public constructors

Builder

Added in API level 37
Also in U Extensions 21
public Builder (Metadata metadata, 
                Instant time, 
                int beverageType)

Builder for an alcohol consumption record that occurs at a specific instant in time.

Parameters
metadata Metadata: The metadata of the record.
This value cannot be null.

time Instant: The time of the record.
This value cannot be null.

beverageType int: The type of beverage consumed. See ERROR(AlcoholConsumptionBeverageType/android.health.connect.datatypes.AlcoholConsumptionRecord.AlcoholConsumptionBeverageType AlcoholConsumptionBeverageType) for valid values.
Value is one of the following:

Builder

Added in API level 37
Also in U Extensions 21
public Builder (Metadata metadata, 
                Instant startTime, 
                Instant endTime, 
                int beverageType)

Builder for an alcohol consumption record that occurs over a time interval.

Parameters
metadata Metadata: The metadata of the record.
This value cannot be null.

startTime Instant: The start time of the record.
This value cannot be null.

endTime Instant: The end time of the record.
This value cannot be null.

beverageType int: The type of beverage consumed. See ERROR(AlcoholConsumptionBeverageType/android.health.connect.datatypes.AlcoholConsumptionRecord.AlcoholConsumptionBeverageType AlcoholConsumptionBeverageType) for valid values.
Value is one of the following:

Builder

Added in API level 37
Also in U Extensions 21
public Builder (Metadata metadata, 
                LocalDate date, 
                int beverageType)

Builder for an alcohol consumption record that occurs on a specific date.

Parameters
metadata Metadata: The metadata of the record.
This value cannot be null.

date LocalDate: The date of the record.
This value cannot be null.

beverageType int: The type of beverage consumed. See ERROR(AlcoholConsumptionBeverageType/android.health.connect.datatypes.AlcoholConsumptionRecord.AlcoholConsumptionBeverageType AlcoholConsumptionBeverageType) for valid values.
Value is one of the following:

Public methods

build

Added in API level 37
Also in U Extensions 21
public AlcoholConsumptionRecord build ()

Returns
AlcoholConsumptionRecord Object of AlcoholConsumptionRecord
This value cannot be null.

clearEndZoneOffset

Added in API level 37
Also in U Extensions 21
public AlcoholConsumptionRecord.Builder clearEndZoneOffset ()

Clears the zone offset of the user when the activity was logged.

Returns
AlcoholConsumptionRecord.Builder This value cannot be null.

clearStartZoneOffset

Added in API level 37
Also in U Extensions 21
public AlcoholConsumptionRecord.Builder clearStartZoneOffset ()

Clears the zone offset of the user when the activity was logged.

Returns
AlcoholConsumptionRecord.Builder This value cannot be null.

setAlcoholByVolume

Added in API level 37
Also in U Extensions 21
public AlcoholConsumptionRecord.Builder setAlcoholByVolume (Percentage alcoholByVolume)

Sets the alcohol by volume of the beverage.

Parameters
alcoholByVolume Percentage: The alcohol by volume. If provided, must be in the range 0.0 to 100.0.
This value may be null.

Returns
AlcoholConsumptionRecord.Builder This value cannot be null.

setBeverageType

Added in API level 37
Also in U Extensions 21
public AlcoholConsumptionRecord.Builder setBeverageType (int beverageType)

Sets the type of beverage the user consumed.

Parameters
beverageType int: The type of beverage consumed. See ERROR(AlcoholConsumptionBeverageType/android.health.connect.datatypes.AlcoholConsumptionRecord.AlcoholConsumptionBeverageType AlcoholConsumptionBeverageType) for valid values.
Value is one of the following:
Returns
AlcoholConsumptionRecord.Builder This value cannot be null.

setEndZoneOffset

Added in API level 37
Also in U Extensions 21
public AlcoholConsumptionRecord.Builder setEndZoneOffset (ZoneOffset endZoneOffset)

Sets the zone offset of the user when the activity was logged.

Parameters
endZoneOffset ZoneOffset: This value cannot be null.

Returns
AlcoholConsumptionRecord.Builder This value cannot be null.

setNotes

Added in API level 37
Also in U Extensions 21
public AlcoholConsumptionRecord.Builder setNotes (CharSequence notes)

Sets the notes for this record.

Parameters
notes CharSequence: This value may be null.

Returns
AlcoholConsumptionRecord.Builder This value cannot be null.

setServingVolume

Added in API level 37
Also in U Extensions 21
public AlcoholConsumptionRecord.Builder setServingVolume (Volume servingVolume)

Sets the volume of a single serving consumed.

Parameters
servingVolume Volume: The volume of a single serving. If provided, must be positive and less than or equal to 255 liters.
This value may be null.

Returns
AlcoholConsumptionRecord.Builder This value cannot be null.

setStartZoneOffset

Added in API level 37
Also in U Extensions 21
public AlcoholConsumptionRecord.Builder setStartZoneOffset (ZoneOffset startZoneOffset)

Sets the zone offset of the user when the activity was logged.

Parameters
startZoneOffset ZoneOffset: This value cannot be null.

Returns
AlcoholConsumptionRecord.Builder This value cannot be null.