Reputation: 620
I am playing some tone using listview.
I want to change a rating bar value using setOnRatingBarChangeListener
.
changeRatingPlayer
.setOnRatingBarChangeListener(new OnRatingBarChangeListener() {
@Override
public void onRatingChanged(RatingBar ratingBar,
float rating, boolean fromUser) {
// TODO Auto-generated method stub
setToneRating();
}
});
Also I want to reset rating bar after the user clicks on some other item of the list.
But when I click on a item of the list and using changeRatingPlayer.setRating(0);
I reset the rating bar, but in the meantime setOnRatingBarChangeListener
is called again, but I don't want this.
Upvotes: 1
Views: 781
Reputation: 35661
Use the fromUser
parameter to determine if the rating was changed by the user or if it was changed by your code.
Upvotes: 3