ラジオグループに3つのラジオボタンがあります。選択したボタンに応じて異なることを行うように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に尋ねるにはどうすればよいですか?