Code example for RatingBar

Methods: getRatingsetRating

0
     
    public void savePreferences() { 
     SharedPreferences pref = getSharedPreferences(MY_PREF, Context.MODE_PRIVATE) ;
     Editor e = pref.edit() ;
     e.putBoolean(MY_CHECKED, cb.isChecked());
     e.putFloat(MY_RATE, rb.getRating());
     e.putBoolean(MY_STATUS, bt.isChecked()) ;
     e.apply();
      
     clearState() ; 
      
     Toast.makeText(this, "Save shered preferences success !", Toast.LENGTH_SHORT).show();
       
    } 
     
    public void clearState() { 
       
      rb.setRating(0);
      cb.setChecked(false);
      bt.setChecked(false) ;
    } 
     
    public void loadPreferences() { 
Experience pair programming with AI  Get Codota for Java