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
public Builder (Metadata metadata, Instant time, int beverageType)
Builder for an alcohol consumption record that occurs at a specific instant in time.
Builder
public Builder (Metadata metadata, Instant startTime, Instant endTime, int beverageType)
Builder for an alcohol consumption record that occurs over a time interval.
Builder
public Builder (Metadata metadata, LocalDate date, int beverageType)
Builder for an alcohol consumption record that occurs on a specific date.
Public methods
build
public AlcoholConsumptionRecord build ()
| Returns | |
|---|---|
AlcoholConsumptionRecord |
Object of AlcoholConsumptionRecord
This value cannot be null. |
clearEndZoneOffset
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
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
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
public AlcoholConsumptionRecord.Builder setBeverageType (int beverageType)
Sets the type of beverage the user consumed.
| Returns | |
|---|---|
AlcoholConsumptionRecord.Builder |
This value cannot be null. |
setEndZoneOffset
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
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
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
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. |