I want to change one activity to another activity. It worked at the first time, But not at the next, How do I fix that?
public class Activity1 extends Activity {
RadioGroup radioGroup;
RadioButton Rd1, Rd2;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.layout_activity1);
radioGroup=(RadioGroup)findViewById(R.id.radioGroup);
Rd1=(RadioButton)findViewById(R.id.radioButton);
Rd2=(RadioButton)findViewById(R.id.radioButton2);
radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
if(Rd1.isChecked())
{
Intent intent = new Intent(getApplicationContext(), Acitivity.class);
startActivity(intent);
}
else {
if (Rd2.isChecked()) {
Intent intent1 = new Intent(getApplicationContext(), Acivity1.class);
startActivity(intent1);
}
}
}
});
}
}