I have 2 activity A and B.when go from A to B,does A destroy?
If yes,does all variables(static or nonstatic) clear or not?
Or if not destroy?does activity goes to some stack?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
it is not destroyed, it will be moved to the stack.. check http://developer.android.com/training/basics/activity-lifecycle/index.html
as Simon said below:
the variables are not destroyed when your activity goes to the stack. However, once an activity is not the active activity, Android may destroy it without any further callbacks to your code. That is what onPause() and onResume() are there for. You should save and restore anything you need to maintain the state of your activity in those methods..
For static vars (If the process is killed then all static variables will be reinitialized to their default values). check Public static variables and Android activity life cycle management