Try the following sample code:
private static final int LAUNCH_A = 100;
private static final int LAUNCH_B = 200;
//launch activity here with extras to decide which other activity to launch next
Intent intent = new Intent(this, Activity1.class);
//Now decide here, which activity you want to launch in the next one
if(shouldLaunchA){
intent.putExtra("LAUNCH_TARGET", LAUNCH_A);
}else{
intent.putExtra("LAUNCH_TARGET", LAUNCH_B);
}
startActivity(intent);
Now, in your Activity 1, you can get the extras and switch on them:
Intent intent = getIntent();
// you could place this as a class level variable:
int launchTarget = intent.getExtras().getInt("LAUNCH_TARGET");
switch(launchTarget){
case 100:
//Launch activity A
break;
case 200:
//launch activity B
break;
}
That is all you need to get this working!
Like I hinted above, you should set the launchTarget
variable as a class level variable so you can access it once the user has enter data to your EditText
fields and clicked a button to submit!
Good luck and let me know if you need further assistance!