You can also maintain a flag value based on listener,
radioButton.setOnCheckedChangeListener(new OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton arg0, boolean arg1) {
//handle the boolean flag here.
if(arg1==true)
//Do something
else
//do something else
}
});
Or simply isChecked()
can also be used to check the state of your RadioButton.
Here is a link to a sample,
http://www.mkyong.com/android/android-radio-buttons-example/
And then based on the flag you can execute your function.