Search code examples
androidratingbar

how to know user clicked first item of rating bar


I am using android rating bar, consider the current rating is one, when user clicks on first star, I want to set rating as zero. Anyone help me. Thank you


Solution

  • Subtract one from the RatingBar value. Note that this will mean that a zero-star value would be -1, as RatingBar starts at 0. If you truly want to consider both zero stars and one star to be the same thing, that's your call.