I have a rating bar in my app and I want to check if the user has rated on the rating bar or not. If it been has rated by the user then , an intent takes you to the next screen and if he has not rated then there is toast message which says "Please rate us!!"
First, you have to set android:rating="0.0"
to your RatingBar
in xml. Then on button click check,
RatingBar ratingbar = (RatingBar)findViewById(R.id.ratingBar);
@Override
public void onClick(View view) {
switch (view.getId()){
case R.id.ratingBar:
if(ratingbar.getRating() == 0.0){
//set what you want
}else{
//give error if ratingbar not changed
}
break;
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With