# Rating

# Rating

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/Rating.java+class:androidx.media3.common.Rating)

*** ** * ** ***

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

<br />

```
abstract class Rating
```

<br />

Known direct subclasses  
[HeartRating](https://developer.android.com/reference/kotlin/androidx/media3/common/HeartRating),[PercentageRating](https://developer.android.com/reference/kotlin/androidx/media3/common/PercentageRating),[StarRating](https://developer.android.com/reference/kotlin/androidx/media3/common/StarRating),[ThumbRating](https://developer.android.com/reference/kotlin/androidx/media3/common/ThumbRating)  

|------------------------------------------------------------------------------------------------------------|-----------------------------------------------------|
| [HeartRating](https://developer.android.com/reference/kotlin/androidx/media3/common/HeartRating)           | A rating expressed as "heart" or "no heart".        |
| [PercentageRating](https://developer.android.com/reference/kotlin/androidx/media3/common/PercentageRating) | A rating expressed as a percentage.                 |
| [StarRating](https://developer.android.com/reference/kotlin/androidx/media3/common/StarRating)             | A rating expressed as a fractional number of stars. |
| [ThumbRating](https://developer.android.com/reference/kotlin/androidx/media3/common/ThumbRating)           | A rating expressed as "thumbs up" or "thumbs down". |

*** ** * ** ***

A rating for media content. The style of a rating can be one of[HeartRating](https://developer.android.com/reference/kotlin/androidx/media3/common/HeartRating),[PercentageRating](https://developer.android.com/reference/kotlin/androidx/media3/common/PercentageRating),[StarRating](https://developer.android.com/reference/kotlin/androidx/media3/common/StarRating), or[ThumbRating](https://developer.android.com/reference/kotlin/androidx/media3/common/ThumbRating).

## Summary

|                                          ### Public functions                                           |
|---------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `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). |
| `abstract `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)          | [isRated](https://developer.android.com/reference/kotlin/androidx/media3/common/Rating#isRated())`()` Whether the rating exists or not.                                                                                                                                                                                                                                                                                    |
| `abstract `[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/Rating#toBundle())`()` Returns a[Bundle](https://developer.android.com/reference/android/os/Bundle.html)representing the information stored in this rating.                                                                      |

## Public functions

### fromBundle

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

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

### isRated

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

Whether the rating exists or not.  

### toBundle

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

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