# WeightRecord

Artifact: [androidx.health.connect:connect-client](https://developer.android.com/jetpack/androidx/releases/health-connect) [View Source](https://cs.android.com/search?q=file:androidx/health/connect/client/records/WeightRecord.kt+class:androidx.health.connect.client.records.WeightRecord) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/health-connect#1.1.0)

*** ** * ** ***


```
public final class WeightRecord implements Record
```

<br />

*** ** * ** ***

Captures the user's weight.

See `https://developer.android.com/reference/androidx/health/connect/client/units/Mass` for supported units.

## Summary

| ### Public fields |
|---|---|
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/aggregate/AggregateMetric<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/units/Mass>` | `https://developer.android.com/reference/androidx/health/connect/client/records/WeightRecord#WEIGHT_AVG()` Metric identifier to retrieve the average weight from `https://developer.android.com/reference/androidx/health/connect/client/aggregate/AggregationResult`. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/aggregate/AggregateMetric<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/units/Mass>` | `https://developer.android.com/reference/androidx/health/connect/client/records/WeightRecord#WEIGHT_MAX()` Metric identifier to retrieve the maximum weight from `https://developer.android.com/reference/androidx/health/connect/client/aggregate/AggregationResult`. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/aggregate/AggregateMetric<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/units/Mass>` | `https://developer.android.com/reference/androidx/health/connect/client/records/WeightRecord#WEIGHT_MIN()` Metric identifier to retrieve the minimum weight from `https://developer.android.com/reference/androidx/health/connect/client/aggregate/AggregationResult`. |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/health/connect/client/records/WeightRecord#WeightRecord(java.time.Instant,java.time.ZoneOffset,androidx.health.connect.client.units.Mass,androidx.health.connect.client.records.metadata.Metadata)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/time/Instant.html time, https://developer.android.com/reference/java/time/ZoneOffset.html zoneOffset, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/units/Mass weight, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata metadata )` |

| ### Public methods |
|---|---|
| `boolean` | `https://developer.android.com/reference/androidx/health/connect/client/records/WeightRecord#equals(kotlin.Any)(https://developer.android.com/reference/java/lang/Object.html other)` |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata` | `https://developer.android.com/reference/androidx/health/connect/client/records/WeightRecord#getMetadata()()` Set of common metadata associated with the written record. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/time/Instant.html` | `https://developer.android.com/reference/androidx/health/connect/client/records/WeightRecord#getTime()()` Time the record happened. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/units/Mass` | `https://developer.android.com/reference/androidx/health/connect/client/records/WeightRecord#getWeight()()` User's weight in kilograms. |
| `https://developer.android.com/reference/java/time/ZoneOffset.html` | `https://developer.android.com/reference/androidx/health/connect/client/records/WeightRecord#getZoneOffset()()` User experienced zone offset at `https://developer.android.com/reference/androidx/health/connect/client/records/InstantaneousRecord#time()`, or null if unknown. |
| `int` | `https://developer.android.com/reference/androidx/health/connect/client/records/WeightRecord#hashCode()()` |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/health/connect/client/records/WeightRecord#toString()()` |

## Public fields

### WEIGHT_AVG

```
public static final @NonNull AggregateMetric<@NonNull Mass> WEIGHT_AVG
```

Metric identifier to retrieve the average weight from `https://developer.android.com/reference/androidx/health/connect/client/aggregate/AggregationResult`.

### WEIGHT_MAX

```
public static final @NonNull AggregateMetric<@NonNull Mass> WEIGHT_MAX
```

Metric identifier to retrieve the maximum weight from `https://developer.android.com/reference/androidx/health/connect/client/aggregate/AggregationResult`.

### WEIGHT_MIN

```
public static final @NonNull AggregateMetric<@NonNull Mass> WEIGHT_MIN
```

Metric identifier to retrieve the minimum weight from `https://developer.android.com/reference/androidx/health/connect/client/aggregate/AggregationResult`.

## Public constructors

### WeightRecord

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/health-connect#1.1.0)

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

## Public methods

### equals

```
public boolean equals(Object other)
```

### getMetadata

```
public @NonNull Metadata getMetadata()
```

Set of common metadata associated with the written record.

### getTime

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/health-connect#1.1.0)

```
public @NonNull Instant getTime()
```

Time the record happened.

### getWeight

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/health-connect#1.1.0)

```
public final @NonNull Mass getWeight()
```

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

### getZoneOffset

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/health-connect#1.1.0)

```
public ZoneOffset getZoneOffset()
```

User experienced zone offset at `https://developer.android.com/reference/androidx/health/connect/client/records/InstantaneousRecord#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()
```