androidactionlistenerratingbar

How to set rating bar to minimum one star?


I have a requirement to rate for a user with minimum of one star and after that ratings should increase to 0.5. But my question is that the user should not change the minimum rating of star to 0.5 or 0. 1 should be the default rating. Please help with this and awaiting for your earlier response. I also tried implementing by listeners from the link but completely struct with the logic inside My code is:

ratingBar.setOnRatingBarChangeListener(new OnRatingBarChangeListener() {

    @Override public void onRatingChanged(RatingBar ratingBar, float rating, 
      boolean fromUser) {

    }
});

Solution

  • Setting Rating takes float value , in Case ur value is String :

    ratingBar.setRating(Float.parseFloat(result));