# HeartRating

# HeartRating

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

*** ** * ** ***

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

<br />

```
class HeartRating : 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.HeartRating](https://developer.android.com/reference/kotlin/androidx/media3/common/HeartRating) |

*** ** * ** ***

A rating expressed as "heart" or "no heart". It can be used to indicate whether the content is a favorite.

## Summary

|                                                                                                              ### Public constructors                                                                                                              |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [HeartRating](https://developer.android.com/reference/kotlin/androidx/media3/common/HeartRating#HeartRating())`()` Creates a unrated instance.                                                                                                    |
| [HeartRating](https://developer.android.com/reference/kotlin/androidx/media3/common/HeartRating#HeartRating(boolean))`(isHeart: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`)` Creates a rated instance. |

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

|                                ### Public properties                                |
|-------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | [isHeart](https://developer.android.com/reference/kotlin/androidx/media3/common/HeartRating#isHeart()) |

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

### HeartRating

```
HeartRating()
```

Creates a unrated instance.  

### HeartRating

```
HeartRating(isHeart: Boolean)
```

Creates a rated instance.  

|                                           Parameters                                           |
|------------------------------------------------------------------------------------------------|------------------------------------------|
| `isHeart: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | `true`for "heart",`false`for "no heart". |

## Public functions

### equals

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

### fromBundle

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

Restores a`HeartRating`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

### isHeart

```
val isHeart: Boolean
```