Question

In my xml I set android:stepSize="1" but when I implement it. It still show 1.0.

how to change it to 1?

rtnCafe.setOnRatingBarChangeListener(new OnRatingBarChangeListener() {

        @Override
        public void onRatingChanged(RatingBar ratingBar, float rating,
                boolean fromUser) {
             Log.i("rating",""+rtnCafe.getRating());
             Toast.makeText(getApplicationContext(), "rating " +rtnCafe.getRating(), Toast.LENGTH_LONG).show();
             txtLove.setText(""+rtnCafe.getRating());

        }
    });
Was it helpful?

Solution

You can just cast it to int like,

txtLove.setText(""+(int)rtnCafe.getRating());

OTHER TIPS

simply add (int) before rtnCafe.getRating(...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top