# PercentageRating

# 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)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/media3/common/PercentageRating "View this page in Java")

<br />

```
class PercentageRating : Rating
```

<br />

|---|---|-----------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)                                                      |||
| ↳ | [androidx.media3.common.Rating](https://developer.android.com/reference/kotlin/androidx/media3/common/Rating)                        ||
|   | ↳ | [androidx.media3.common.PercentageRating](https://developer.android.com/reference/kotlin/androidx/media3/common/PercentageRating) |

*** ** * ** ***

A rating expressed as a percentage.

## Summary

|                                                                                                                                                                                         ### Public constructors                                                                                                                                                                                         |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [PercentageRating](https://developer.android.com/reference/kotlin/androidx/media3/common/PercentageRating#PercentageRating())`()` Creates a unrated instance.                                                                                                                                                                                                                                           |
| [PercentageRating](https://developer.android.com/reference/kotlin/androidx/media3/common/PercentageRating#PercentageRating(float))`(percent: @`[FloatRange](https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange)`(from = 0, to = 100) `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`)` Creates a rated instance with the given percentage. |

|                                                    ### Public functions                                                     |
|-----------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                                         | [equals](https://developer.android.com/reference/kotlin/androidx/media3/common/PercentageRating#equals(java.lang.Object))`(obj: `[Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)`?)`                                                                                                                                                                                                                               |
| `java-static `[PercentageRating](https://developer.android.com/reference/kotlin/androidx/media3/common/PercentageRating)`!` | `@`[UnstableApi](https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi) [fromBundle](https://developer.android.com/reference/kotlin/androidx/media3/common/PercentageRating#fromBundle(android.os.Bundle))`(bundle: `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)`!)` Restores a`PercentageRating`from a[Bundle](https://developer.android.com/reference/android/os/Bundle.html). |
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                                                 | [hashCode](https://developer.android.com/reference/kotlin/androidx/media3/common/PercentageRating#hashCode())`()`                                                                                                                                                                                                                                                                                                                              |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                                         | [isRated](https://developer.android.com/reference/kotlin/androidx/media3/common/PercentageRating#isRated())`()` Whether the rating exists or not.                                                                                                                                                                                                                                                                                              |
| [Bundle](https://developer.android.com/reference/android/os/Bundle.html)`!`                                                 | `@`[UnstableApi](https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi) [toBundle](https://developer.android.com/reference/kotlin/androidx/media3/common/PercentageRating#toBundle())`()` Returns a[Bundle](https://developer.android.com/reference/android/os/Bundle.html)representing the information stored in this rating.                                                                                |

|                              ### Public properties                              |
|---------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------|
| [Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) | [percent](https://developer.android.com/reference/kotlin/androidx/media3/common/PercentageRating#percent()) |

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

## Public constructors

### PercentageRating

```
PercentageRating()
```

Creates a unrated instance.  

### PercentageRating

```
PercentageRating(percent: @FloatRange(from = 0, to = 100) Float)
```

Creates a rated instance with the given percentage.  

|                                                                                                  Parameters                                                                                                   |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------|
| `percent: @`[FloatRange](https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange)`(from = 0, to = 100) `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) | The percentage value of the rating. |

## Public functions

### equals

```
fun equals(obj: Any?): Boolean
```  

### fromBundle

```
@UnstableApi
java-static fun fromBundle(bundle: Bundle!): PercentageRating!
```

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

### hashCode

```
fun hashCode(): Int
```  

### isRated

```
fun isRated(): Boolean
```

Whether the rating exists or not.  

### toBundle

```
@UnstableApi
fun toBundle(): Bundle!
```

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

## Public properties

### percent

```
val percent: Float
```