ThePikeman's solution is fine, but depending on how many buttons you have, you might want to consider an array that you can iterate over.
For a small number of buttons, the Pikeman code can be simplified to preserve some typing ...
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked){ if (buttonView != one) { one.setChecked(false); } if (buttonView != two) { two.setChecked(false); } if (buttonView != three) { three.setChecked(false); } if (buttonView != four) { four.setChecked(false); } } }
source share