Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
429 views
in Technique[技术] by (71.8m points)

Life cycle of Android Activity after pressing Back button

I am little confused between the life cycle of two activities.

Suppose I have Activity A and Activity B.

B is called From A i.e A ----> B.

Now currently B is on the screen and I pressed back button. Here I want know:- is there any memory still available for B(Active) or B's memory is flushed(Inactive).

question from:https://stackoverflow.com/questions/22011751/life-cycle-of-android-activity-after-pressing-back-button

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Suppose there is an activity A, from which you launch activity B. If, while in activity B, you hit the back button, you are popping activity B off the stack and B will not be in the activity stack any longer.

Whenever you push an activity to the stack, onCreate is called, and if you press back button, onDestroy is called, which means that the activity is flushed away.

stack

Please visit my blog for further information: http://upadhyayjiteshandroid.blogspot.in/2013/02/android-lifecycle.html

activity lifecycle please visit for more

http://developer.android.com/guide/components/tasks-and-back-stack.html

http://developer.android.com/training/basics/activity-lifecycle/starting.html


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...