Here are the examples of the java api class android.support.v4.media.RatingCompat taken from open source projects.
1. MediaNotification#updateFavoriteAction()
Project: tomahawk-android
File: MediaNotification.java
File: MediaNotification.java
private void updateFavoriteAction() { Log.d(TAG, "updateFavoriteAction"); String favoriteLabel; int favoriteIcon; RatingCompat rating = mMetadata.getRating(MediaMetadataCompat.METADATA_KEY_USER_RATING); if (rating != null && rating.hasHeart()) { favoriteLabel = mService.getString(R.string.playback_unfavorite); favoriteIcon = R.drawable.ic_action_favorites_small_underlined; } else { favoriteLabel = mService.getString(R.string.playback_favorite); favoriteIcon = R.drawable.ic_action_favorites_small; } if (mFavoriteAction == null) { mFavoriteAction = new NotificationCompat.Action.Builder(favoriteIcon, favoriteLabel, mIntents.get(favoriteIcon)).build(); } else { mFavoriteAction.icon = favoriteIcon; mFavoriteAction.title = favoriteLabel; mFavoriteAction.actionIntent = mIntents.get(favoriteIcon); } }