# PercentageRating

Artifact: [androidx.media3:media3-common](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/common/PercentageRating.java+class:androidx.media3.common.PercentageRating)

*** ** * ** ***


```
public final class PercentageRating extends Rating
```

<br />

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) |||
| ↳ | [androidx.media3.common.Rating](https://developer.android.com/reference/androidx/media3/common/Rating) ||
|   | ↳ | [androidx.media3.common.PercentageRating](https://developer.android.com/reference/androidx/media3/common/PercentageRating) |

*** ** * ** ***

A rating expressed as a percentage.

## Summary

| ### Public fields |
|---|---|
| `final float` | `https://developer.android.com/reference/androidx/media3/common/PercentageRating#percent()` |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/media3/common/PercentageRating#PercentageRating()()` Creates a unrated instance. |
| `https://developer.android.com/reference/androidx/media3/common/PercentageRating#PercentageRating(float)(@https://developer.android.com/reference/androidx/annotation/FloatRange(from = 0, to = 100) float percent)` Creates a rated instance with the given percentage. |

| ### Public methods |
|---|---|
| `boolean` | `https://developer.android.com/reference/androidx/media3/common/PercentageRating#equals(java.lang.Object)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Object.html obj)` |
| `static https://developer.android.com/reference/androidx/media3/common/PercentageRating` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/PercentageRating#fromBundle(android.os.Bundle)(https://developer.android.com/reference/android/os/Bundle.html bundle)` Restores a `PercentageRating` from a `https://developer.android.com/reference/android/os/Bundle.html`. |
| `float` | `https://developer.android.com/reference/androidx/media3/common/PercentageRating#getPercent()()` Returns the percent value of this rating. |
| `int` | `https://developer.android.com/reference/androidx/media3/common/PercentageRating#hashCode()()` |
| `boolean` | `https://developer.android.com/reference/androidx/media3/common/PercentageRating#isRated()()` Whether the rating exists or not. |
| `https://developer.android.com/reference/android/os/Bundle.html` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/PercentageRating#toBundle()()` Returns a `https://developer.android.com/reference/android/os/Bundle.html` representing the information stored in this rating. |

| ### Inherited methods |
|---|
| From [androidx.media3.common.Rating](https://developer.android.com/reference/androidx/media3/common/Rating) |---|---| | `static https://developer.android.com/reference/androidx/media3/common/Rating` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/Rating#fromBundle(android.os.Bundle)(https://developer.android.com/reference/android/os/Bundle.html bundle)` Restores a `Rating` from a `https://developer.android.com/reference/android/os/Bundle.html`. | |

## Public fields

### percent

```
public final float percent
```

## Public constructors

### PercentageRating

```
public PercentageRating()
```

Creates a unrated instance.

### PercentageRating

```
public PercentageRating(@FloatRange(from = 0, to = 100) float percent)
```

Creates a rated instance with the given percentage.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/FloatRange(from = 0, to = 100) float percent` | The percentage value of the rating. |

## Public methods

### equals

```
public boolean equals(@Nullable Object obj)
```

### fromBundle

```
@UnstableApi
public static PercentageRating fromBundle(Bundle bundle)
```

Restores a `PercentageRating` from a `https://developer.android.com/reference/android/os/Bundle.html`.

### getPercent

```
public float getPercent()
```

Returns the percent value of this rating. Will be within the range `[0f, 100f]`, or `https://developer.android.com/reference/androidx/media3/common/Rating#RATING_UNSET()` if unrated.

### hashCode

```
public int hashCode()
```

### isRated

```
public boolean isRated()
```

Whether the rating exists or not.

### toBundle

```
@UnstableApi
public Bundle toBundle()
```

Returns a `https://developer.android.com/reference/android/os/Bundle.html` representing the information stored in this rating.