Android Dev Summit, October 23-24: two days of technical content, directly from the Android team. Sign-up for livestream updates.

HeartRating

public final class HeartRating
extends Object implements Rating

java.lang.Object
   ↳ androidx.media2.session.HeartRating


A class for rating with a single degree of rating, "heart" vs "no heart". This can be used to indicate the content referred to is a favorite (or not).

Summary

Public constructors

HeartRating()

Creates a unrated HeartRating instance.

HeartRating(boolean hasHeart)

Creates a HeartRating instance.

Public methods

boolean equals(Object obj)
boolean hasHeart()

Returns whether the rating is "heart selected".

int hashCode()
boolean isRated()

Returns whether there is a rating value available.

String toString()

Inherited methods

Public constructors

HeartRating

public HeartRating ()

Creates a unrated HeartRating instance.

HeartRating

public HeartRating (boolean hasHeart)

Creates a HeartRating instance.

Parameters
hasHeart boolean: true for a "heart selected" rating, false for "heart unselected".

Public methods

equals

public boolean equals (Object obj)

Parameters
obj Object

Returns
boolean

hasHeart

public boolean hasHeart ()

Returns whether the rating is "heart selected".

Returns
boolean true if the rating is "heart selected", false if the rating is "heart unselected", or if it is unrated.

hashCode

public int hashCode ()

Returns
int

isRated

public boolean isRated ()

Returns whether there is a rating value available.

Returns
boolean true if there is an available rating value.

toString

public String toString ()

Returns
String