Builder


class Builder
kotlin.Any
   ↳ android.health.connect.datatypes.AlcoholConsumptionRecord.Builder

Builder class for AlcoholConsumptionRecord

Summary

Public constructors
Builder(metadata: Metadata, time: Instant, beverageType: Int)

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

Builder(metadata: Metadata, startTime: Instant, endTime: Instant, beverageType: Int)

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

Builder(metadata: Metadata, date: LocalDate, beverageType: Int)

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

Public methods
AlcoholConsumptionRecord

AlcoholConsumptionRecord.Builder

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

AlcoholConsumptionRecord.Builder

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

AlcoholConsumptionRecord.Builder
setAlcoholByVolume(alcoholByVolume: Percentage?)

Sets the alcohol by volume of the beverage.

AlcoholConsumptionRecord.Builder
setBeverageType(beverageType: Int)

Sets the type of beverage the user consumed.

AlcoholConsumptionRecord.Builder
setEndZoneOffset(endZoneOffset: ZoneOffset)

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

AlcoholConsumptionRecord.Builder

Sets the notes for this record.

AlcoholConsumptionRecord.Builder
setServingVolume(servingVolume: Volume?)

Sets the volume of a single serving consumed.

AlcoholConsumptionRecord.Builder
setStartZoneOffset(startZoneOffset: ZoneOffset)

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

Public constructors

Builder

Builder(
    metadata: Metadata,
    time: Instant,
    beverageType: Int)

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 android.health.connect.datatypes.AlcoholConsumptionRecord.AlcoholConsumptionBeverageType for valid values.
Value is one of the following:

Builder

Builder(
    metadata: Metadata,
    startTime: Instant,
    endTime: Instant,
    beverageType: Int)

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 android.health.connect.datatypes.AlcoholConsumptionRecord.AlcoholConsumptionBeverageType for valid values.
Value is one of the following:

Builder

Builder(
    metadata: Metadata,
    date: LocalDate,
    beverageType: Int)

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 android.health.connect.datatypes.AlcoholConsumptionRecord.AlcoholConsumptionBeverageType for valid values.
Value is one of the following:

Public methods

build

fun build(): AlcoholConsumptionRecord
Return
AlcoholConsumptionRecord Object of AlcoholConsumptionRecord
This value cannot be null.

clearEndZoneOffset

fun clearEndZoneOffset(): AlcoholConsumptionRecord.Builder

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

Return
AlcoholConsumptionRecord.Builder This value cannot be null.

clearStartZoneOffset

fun clearStartZoneOffset(): AlcoholConsumptionRecord.Builder

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

Return
AlcoholConsumptionRecord.Builder This value cannot be null.

setAlcoholByVolume

fun setAlcoholByVolume(alcoholByVolume: Percentage?): AlcoholConsumptionRecord.Builder

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.
Return
AlcoholConsumptionRecord.Builder This value cannot be null.

setBeverageType

fun setBeverageType(beverageType: Int): AlcoholConsumptionRecord.Builder

Sets the type of beverage the user consumed.

Parameters
beverageType Int: The type of beverage consumed. See android.health.connect.datatypes.AlcoholConsumptionRecord.AlcoholConsumptionBeverageType for valid values.
Value is one of the following:
Return
AlcoholConsumptionRecord.Builder This value cannot be null.

setEndZoneOffset

fun setEndZoneOffset(endZoneOffset: ZoneOffset): AlcoholConsumptionRecord.Builder

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

Parameters
endZoneOffset ZoneOffset: This value cannot be null.
Return
AlcoholConsumptionRecord.Builder This value cannot be null.

setNotes

fun setNotes(notes: CharSequence?): AlcoholConsumptionRecord.Builder

Sets the notes for this record.

Parameters
notes CharSequence?: This value may be null.
Return
AlcoholConsumptionRecord.Builder This value cannot be null.

setServingVolume

fun setServingVolume(servingVolume: Volume?): AlcoholConsumptionRecord.Builder

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.
Return
AlcoholConsumptionRecord.Builder This value cannot be null.

setStartZoneOffset

fun setStartZoneOffset(startZoneOffset: ZoneOffset): AlcoholConsumptionRecord.Builder

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

Parameters
startZoneOffset ZoneOffset: This value cannot be null.
Return
AlcoholConsumptionRecord.Builder This value cannot be null.