The docs says this:

http://developer.android.com/guide/topics/fundamentals/activities.html#Lifecycle

>>
If an activity is paused or stopped, the system can drop it from memory either by asking it to finish (calling its |finish()| method), or simply killing its process.
<<

IIRC, the emulator has a setting / button somewhere to trigger the destruction of unused activities without killing the process, so there is a way to test this case.

More below:

10.07.2011 19:17, nadam ?????:
In a low memory situation Android can shut down apps and has some
logic to prioritize which apps to shut down first. I have read some
comments that Android can also partially destroy an app by destroying
Activities that are not currently used. Since I haven't found any
documentation about this, I suspect that this could be a
misunderstanding and that what they are experiencing is in fact that
the whole app has been destroyed and then the app has been started
again by the user.

Example:
1. The app starts and creates ActivityA
2. ActivityA starts ActivityB
3. ActivityB starts another app, for instance Google Maps
4. Android destroys only ActivityA due to low memory

In this case, the entire application goes into background state (unless there is a foreground service, etc.), so I'd be surprised if this actually happens, or should be expected.

But what actually happened:
4. Android destroys the whole app due to low memory
5. The user presses the back-button
6. The app starts again and creates ActivityB
7. Developer thinks (based on stack-traces) that the app has been
running all the time but only ActivityA was destroyed

Not sure what you mean by "developer thinks" - if the entire process was destroyed, then the new process id will be different. You can easily see this in the logcat or other tools (DDMS, ps, top).

If Android can in fact destroy just a single Activity, how is the
decision made between destroying unused Activities in the least 5
prioritized apps vs. completely destroying the least 2 prioritized
apps?

Or is the partial destroying just a myth (like the destroying statics
myth)?


--
Kostya Vasilyev

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to