Reputation: 5996
I have a RadioGroup
radioGroup with 2 RadioButton
rb1 and rb2.
User checks 1 of them, say rb1, at some point of time. Now based on some condition, I want to clean the RadioGroup
i.e.all it's children should be unchecked.
I'm doing so by rb1.setChecked(false);
and rb2.setChecked(false);
.
After this when I call radioGroup.getCheckedRadioButtonId();
, I'm expecting -1 as return value, but what I get is the id of rb1, which I had checked earlier.
Am I doing something wrong?
Any help appreciated.
Upvotes: 0
Views: 1376
Reputation: 39406
You need to call radioGroup.clearCheck()
See the doc : http://developer.android.com/reference/android/widget/RadioGroup.html#clearCheck()
Upvotes: 2