Issue
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?
Solution
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).
Answered By - Ahmad
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.