RatingBar sending value to TextView android [closed]

-1

Good afternoon, How do I pass the value of a RatingBar to a direct TextView without using clicks?

    
asked by anonymous 02.09.2016 / 21:05

2 answers

1
TextView textView = (TextView) findViewById(R.id.textView);
RatingBar ratingBar = (RatingBar) findViewById(R.id.ratingBar);   
ratingBar.setOnRatingBarChangeListener(new RatingBar.OnRatingBarChangeListener() {
    @Override
    public void onRatingChanged(RatingBar ratingBar, float rating, boolean fromUser) {
        textView.setText(String.valueOf(rating));
    }
});
    
02.09.2016 / 21:13
0

You can use the call:

ratingBar.getRating();

But this value is a Float, then just convert to String or use as Float.

    
02.09.2016 / 21:12