我试图在OnCheckedChangeListener
上设置RadioGroup
,但是Android Studio在编写时给我一个错误。
我曾经参加过广播组
RadioGroup CheckList1 = (RadioGroup)findViewById(R.id.First_id_radio_group);
RadioGroup.setOnCheckedChangeListener(new OnCheckedChangeListener) {
}
当我按照建议(CheckList1.setOnCheckedChangeListener(...)
编写它时,在Android Studio中收到以下警告,该方法被删除:
答案 0 :(得分:0)
RadioGroup radioGroup = (RadioGroup) findViewById(R.id.yourRadioGroup);
radioGroup.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
// checkedId is the RadioButton selected
}
});