简体   繁体   中英

How an Activity can be destroyed


I was reading the following article http://developer.android.com/training/basics/activity-lifecycle/recreating.html aobut recreating an activity and it says that:

There are a few scenarios in which your activity is destroyed due to normal app behavior, such as when the user presses the Back button or....

My question is: when I click back is my activity destroyed? Cuz i can still see my app in the most recent app...I don't understand

when I click back is my activity destroyed?

By default, yes.

Cuz i can still see my app in the most recent app

The recent tasks list has nothing whatsoever to do with whether or not an activity in your app is destroyed.

To draw an analogy, operating systems like Windows and Linux sometimes have a "Recent Documents" list. As the name suggests, this is a list of recently-opened documents. When you close, say, Microsoft Word, that does not get rid of the document from the "Recent Documents" list, because "Recent Documents" is not referring to running programs.

Similarly, the recent tasks list refers to apps -- not documents -- that were recently run by the user. Whether or not any activities are destroyed in a given app on that list, or if the app is even running, does not affect the list.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM