I have two radio buttons in a radio group and when i select any of the radio button and try to get the boolean value using the isselected method then i always get the false value. Why this is happening.Please help me.
Asked
Active
Viewed 2,057 times
1
-
2Check for the **isChecked** property: http://stackoverflow.com/a/11050112/2649012 – Phantômaxx Apr 28 '14 at 10:38
4 Answers
2
I had the same problem too, isSelected method didn't work. The isChecked method worked for me:
if( myRadioButton.isChecked() ){
// do stuff
} else {
// do other stuff
}

matlab n00b
- 21
- 4
0
Use this:
radioButton.setOnCheckedChangeListener(new OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton btn, boolean isCheck) {
//handle the boolean flag here.
if(isCheck==true)
//Do something
else
//do something else
}
});
source: link

Community
- 1
- 1

SacreDeveloper
- 1,253
- 1
- 9
- 16