の数(カウント)を作成していますRadioButton。それぞれに1がRadioGroup必要なので、使用できません。ただし、すべてのsと同様に、一度に1つだけを選択する必要があります。IDを設定し、でそれを読み取ってすべてを変更できると思いましたが、クリックしたものはfalseになります。RadioButtonButtonTableRowRadioButtononCheckedChanged
rb = new RadioButton[count];
For-loop....
rb[i] = new RadioButton(this);
rb[i].setId(5000 + i);
rb[i].setOnCheckedChangeListener(this);
そしてonCheckedChanged:
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked)
{
for (int i = 0; i < count; i++)
{
if (buttonView.getId() == 5000 + i)
{
// Its the one
}
else
{
// Its not the one
RadioButton rb = (RadioButton) findViewById((5000 + count));
rb.setChecked(false);
}
}
}
私は正しいものを捕まえますRadioButton、しかし私がそれを試みるとき.setChecked(false)それは私にを与えますNullPointerException、そして私は理由がわかりません。