zer0uno
zer0uno

Reputation: 8030

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

Upvotes: 0

Views: 128

Answers (1)

CommonsWare
CommonsWare

Reputation: 1007554

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.

Upvotes: 3

Related Questions