Start New Activity When User Click "Back" From Another Activity
I have a splash screen activity at the startup of app. the startup splash screen has finish(), so user will not see startup splash screen anymore when they press BACK from the las
Solution 1:
Why don't you override back button on Activity A with starting activity code for Splash 2? I think this is the only solution.
For example:
@Override
public void onBackPressed() {
Intent setIntent = new Intent(ActivityA.this, Splash2.class);
startActivity(setIntent);
finish();
}
Solution 2:
You can just override finish() method, adding startActivity.
Solution 3:
As simple as
call your activity A from splash with startActivityForResult method without calling finish
override onActivityResult of splash to show the end splash screen
Solution 4:
Depending on when you want the user to exit. If it's only in Activity A, you can simply override onKeyDown in that one, otherwise override it in each Activity you got.
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if ((keyCode == KeyEvent.KEYCODE_BACK)) {
startActivity(new Intent("com.android.splashscreen"));
finish();
}
}
Create and start your end-splashscreen.
Solution 5:
over ride method of Activity A onBackPressed()
. Inside this you can start your splash screen 2/END activity.
Post a Comment for "Start New Activity When User Click "Back" From Another Activity"