
Untitled
By: a guest on
Aug 11th, 2012 | syntax:
None | size: 0.80 KB | hits: 5 | expires: Never
How to use RatingBar in my music player i created for android?
RatingBar ratingBar = (RatingBar)view.findViewById(R.id.ratingbar);
RatingBar.OnRatingBarChangeListener barListener =
new RatingBar.OnRatingBarChangeListener() {
public void onRatingChanged(RatingBar ratingBar, float rating, boolean fromTouch) {
// Do your database stuff here
}
}
//mp is the reference to your media player
mp.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
public void onCompletion(MediaPlayer mp) {
// Do what you need to do to reset the rating bar. Might need to make a public reference or create a way for this inner class to access the rating bar.
}
});
ratingbar.setRating(3); //For three stars