RadioGroup r1 = (RadioGroup) view.findViewById(R.id.first);
r1.setOnCheckedChangeListener(new OnCheckedChangeListener()
{
public void onCheckedChanged(RadioGroup group, int checkedId)
{
Utilities.createDebugToastMsg(rootView.getContext(), "clicked on R1");
}
});
RadioGroup r2 = (RadioGroup) view.findViewById(R.id.second);
r2.setOnCheckedChangeListener(new OnCheckedChangeListener() {
public void onCheckedChanged(RadioGroup group, int checkedId) {
Utilities.createDebugToastMsg(rootView.getContext(), "clicked on R2");
}
});
}
我有两个独立的单选组,每个组由三个单选按钮组成。现在,无论我单击哪个单选按钮,都会调用两个侦听器,并且我会收到两个 toast 消息。请帮助并指出我是否遗漏或搞砸了任何事情。谢谢是提前。