Note that there are some explanatory texts on larger screens.

plurals
  1. PORatingBar : same rating twice
    primarykey
    data
    text
    <p>My problem is when i rate the same value again, it doesn't respond to the second time..That means when i rate '4' as for the first time,then i can't rate as'4' for the second time..It only responds only when i rate other value rather than '4'.<br/></p> <p>Here is what i tried( I need the action for <code>getRatingBar</code> in my code).</p> <pre><code>public class InteractiveRatingBarActivity extends Activity implements OnRatingBarChangeListener { RatingBar getRatingBar; RatingBar setRatingBar; TextView countText; int count; float curRate; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); findViewsById(); setRatingBar.setRating(curRate);//overall rating getRatingBar.setOnRatingBarChangeListener(this);// ratingbar for user action. } private void findViewsById() { getRatingBar = (RatingBar) findViewById(R.id.getRating); setRatingBar = (RatingBar) findViewById(R.id.setRating); countText = (TextView) findViewById(R.id.countText); } public void onRatingChanged(RatingBar rateBar, float rating, boolean fromUser) { DecimalFormat decimalFormat = new DecimalFormat("#.#"); curRate = Float.valueOf(decimalFormat.format((curRate * count + rating) / ++count)); Toast.makeText(InteractiveRatingBarActivity.this, "New Rating: " + curRate, Toast.LENGTH_SHORT).show(); setRatingBar.setRating(curRate); countText.setText(count + " Ratings"); } } </code></pre> <p>thanks in advance</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload