Helpful Information
 
 
Category: Android Development
Radio Button group logic

Hi,
I am trying to implement the logic for radio button group but it is not working. I want it to work like...

If radio button1 is selected and submit is clicked, activity1 is seen and if radio button2 is selected and submit is clicked, activity2 is seen.

can any one help me plz?

Hi,
I am trying to implement the logic for radio button group but it is not working. I want it to work like...

If radio button1 is selected and submit is clicked, activity1 is seen and if radio button2 is selected and submit is clicked, activity2 is seen.

can any one help me plz?

Make onClick listener for each radio button on Radio Group


public void onRadioButtonClicked(View view) {
// Is the button now checked?
boolean checked = ((RadioButton) view).isChecked();

// Check which radio button was clicked
switch(view.getId()) {
case R.id.radio0:
if (checked)
// start your activity 1 here
break;
case R.id.radio1:
if (checked)
// start your activity 2 here
break;
}
}

Make onClick listener for each radio button on Radio Group


public void onRadioButtonClicked(View view) {
// Is the button now checked?
boolean checked = ((RadioButton) view).isChecked();

// Check which radio button was clicked
switch(view.getId()) {
case R.id.radio0:
if (checked)
// start your activity 1 here
break;
case R.id.radio1:
if (checked)
// start your activity 2 here
break;
}
}

Not working any other solution ?










privacy (GDPR)