Good afternoon, How do I pass the value of a RatingBar to a direct TextView without using clicks?
Good afternoon, How do I pass the value of a RatingBar to a direct TextView without using clicks?
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));
}
});
You can use the call:
ratingBar.getRating();
But this value is a Float, then just convert to String or use as Float.