我在一个单选组中有三个单选按钮。如何根据选择的按钮告诉 Java 做不同的事情?我声明了组和所有按钮:
final RadioGroup size = (RadioGroup)findViewById(R.id.RGSize);
final RadioButton small = (RadioButton)findViewById(R.id.RBS);
final RadioButton medium = (RadioButton)findViewById(R.id.RBM);
final RadioButton large = (RadioButton)findViewById(R.id.RBL);
我知道我会这样说:
if (size.getCheckedRadioButtonId().equals(small){
} else{
}
但是equals不是正确的语法...我怎么问java选择了哪个按钮?