Reputation: 2368
wasnt really sure what words to query in google, so im just going to ask this question.
What happens to an activity when i start another activity?
Lets say I am currently on activity A, then from a, i called a function to startService a new intent that opens activity B. What happens to the lifecycle of A? is it destroyed? stopped?
Subquestion. If the activity is paused, how do i call/open it back from the newly started activity?
Upvotes: 12
Views: 8364
Reputation: 19189
Activity A is paused, then stopped - both the onPause()
& onStop()
methods are called, but onDestroy()
is not called. The Activity still remains in the back stack.
Quoting the Android documentation:
Activity Lifecycle
Activities in the system are managed as an activity stack. When a new activity is started, it is placed on the top of the stack and becomes the running activity -- the previous activity always remains below it in the stack, and will not come to the foreground again until the new activity exits.
Upvotes: 16