Hello, I want to share my experience when I faced some problems/obstructions while working related to android life cycle. Please guide me in correct way if I am wrong anywhere.
Q1) Explain the flow of activity life cycle when control transfers from Activity 'A' to Activity 'B'.
Ans) Accoding to my observation, when control transfers from A to B, following methods will executed.
Q1) Explain the flow of activity life cycle when control transfers from Activity 'A' to Activity 'B'.
Ans) Accoding to my observation, when control transfers from A to B, following methods will executed.
Explanation:
1) onPause( ) method of Activity A will be called.
2) onCreate() method of Activity B will be called.
3) onResume() method of Activity B will be called.
4) onStop() method of activity A will be called.
Q2) Explain the flow of activity life cycle when user presses back button in Activity 'B'.
Ans) When user presses back button in Activity B, then Activity A will get focussed. The following methods will be executed.
Explanation:
1) onPause( ) method of Activity B will be called.
2) onRestart() method of Activity A will be called.
3) onResume() method of Activity A will be called.
4) onStop() method of activity B will be called.
5) onDestroy() method of activity B will be called.