1

As i am new to Android i need clarify some doubts in Activity Life cycle. I have two activities A and B. I launched first Activity A and i called Activity B from Activity A. So, Activity A went into onPause() state and onStart() state will start for Activity B. Now i pressed BACK key in Acitivity B.So, automatically onResume() method of Activity A will start.

Then what is state of Activity B?? onPause() or onStop()? Again if we press BACK key in Activity A what will happen? It goes to Activity B or close the application?

4

2 回答 2

2

Then what is state of Activity B?

If you hit the back key then, unless you overrode onBackPressed(), the Activity will be finished (finish()). -> The Activity state will be destroyed (onDestroy()).

Again if we press BACK key in Activity A what will happen?

Activity A will also be finished and the app will close itself (since there is no other Activity in the backstack).

于 2013-03-31T03:34:16.070 回答
1

AS we pressing back button Activity B should be destroyed After that we are again going back from Activity A hence application should close

于 2013-05-17T09:34:43.920 回答