私のメイン アクティビティには、グループ ラジオ ボタンがあります。それぞれがクリックされると、異なるアクティビティが開始されます。すべてのアクティビティの XML は同じですが、入力と機能は異なります。つまり、ラジオ グループはすべてのアクティビティに共通です。例: 最初のラジオ ボタンをクリックすると、別のアクティビティが開始され、ラジオ ボックスの選択が消えます。別のアクティビティであっても、グループの別のラジオ ボタンがクリックされるまで、クリックされたラジオ ボタンの選択をオンにしておく必要があります。これを機能させるにはどうすればよいですか?どんな助けでも大歓迎です!
public void onRadioButtonClicked(View view){
boolean checked = ((RadioButton) view).isChecked();
// Check which radio button was clicked
switch(view.getId()) {
case R.id.radio_199os:
if (checked){
Intent intent = new Intent(MainActivity.this, second.class);
startActivity(intent);
}
break;
case R.id.radio_399os:
if (checked){
Intent intent = new Intent(MainActivity.this, Third.class);
startActivity(intent);
}
break;
case R.id.radio_2000os:
if (checked){
Intent intent = new Intent(MainActivity.this, Fourth.class);
startActivity(intent);
}
//
break;
}
}