Skip to content Skip to sidebar Skip to footer

When Finish() Should Be Called?

I have an activity that calls second activity through an intent. After the second Activity is called I want to finish the first activity. Thus, I have the following code in onStop(

Solution 1:

Normally, you should call finish() for your first activity right after you send an intent. Something like:

...
startActivity(secondActivityIntent);
finish();

This will trigger onPause()->onStop()->onDestroy() chain for your first activity, so you can perform normal clean-up there

Post a Comment for "When Finish() Should Be Called?"