public final class WeightRecord implements Record


Captures the user's weight.

See Mass for supported units.

Summary

Public fields

static final @NonNull AggregateMetric<@NonNull Mass>

Metric identifier to retrieve the average weight from androidx.health.connect.client.aggregate.AggregationResult.

static final @NonNull AggregateMetric<@NonNull Mass>

Metric identifier to retrieve the maximum weight from androidx.health.connect.client.aggregate.AggregationResult.

static final @NonNull AggregateMetric<@NonNull Mass>

Metric identifier to retrieve the minimum weight from androidx.health.connect.client.aggregate.AggregationResult.

Public constructors

WeightRecord(
    @NonNull Instant time,
    ZoneOffset zoneOffset,
    @NonNull Mass weight,
    @NonNull Metadata metadata
)

Public methods

boolean
equals(Object other)
@NonNull Metadata

Set of common metadata associated with the written record.

@NonNull Instant

Time the record happened.

final @NonNull Mass

User's weight in kilograms.

ZoneOffset

User experienced zone offset at time, or null if unknown.

int
@NonNull String

Public fields

WEIGHT_AVG

public static final @NonNull AggregateMetric<@NonNull MassWEIGHT_AVG

Metric identifier to retrieve the average weight from androidx.health.connect.client.aggregate.AggregationResult.

WEIGHT_MAX

public static final @NonNull AggregateMetric<@NonNull MassWEIGHT_MAX

Metric identifier to retrieve the maximum weight from androidx.health.connect.client.aggregate.AggregationResult.

WEIGHT_MIN

public static final @NonNull AggregateMetric<@NonNull MassWEIGHT_MIN

Metric identifier to retrieve the minimum weight from androidx.health.connect.client.aggregate.AggregationResult.

Public constructors

WeightRecord

Added in 1.1.0-alpha10
public WeightRecord(
    @NonNull Instant time,
    ZoneOffset zoneOffset,
    @NonNull Mass weight,
    @NonNull Metadata metadata
)

Public methods

equals

public boolean equals(Object other)

getMetadata

Added in 1.1.0-alpha10
public @NonNull Metadata getMetadata()

Set of common metadata associated with the written record.

getTime

Added in 1.1.0-alpha10
public @NonNull Instant getTime()

Time the record happened.

getWeight

Added in 1.1.0-alpha10
public final @NonNull Mass getWeight()

User's weight in kilograms. Required field. Valid range: 0-1000 kilograms.

getZoneOffset

Added in 1.1.0-alpha10
public ZoneOffset getZoneOffset()

User experienced zone offset at time, or null if unknown. Providing these will help history aggregations results stay consistent should user travel. Queries with user experienced time filters will assume system current zone offset if the information is absent.

hashCode

public int hashCode()

toString

public @NonNull String toString()