Skip to content Skip to sidebar Skip to footer

Android How To Switch Between Intents

I have 3 activities. start / game / finish, I want to go start to game, game to finish, finish to start. but when I use Intent one to another when I finish() 'finish' Its come back

Solution 1:

When you call startActivity(...) in "game" Activity to start the "finish" Activity, immediately call finish() so "game" terminates. If you do that then BACK in the "finish" Activity will return to "start" because "game" self-terminated.

Intent intent = new Intent(getApplicationContext(),FinishScreen.class); 
startActivity(intent);
finish();

Solution 2:

The finish() method should work, try with: System.exit(0);


Post a Comment for "Android How To Switch Between Intents"