Killing activities when memory gets short
gnu at toad.com
Sun Aug 8 19:21:15 EDT 2010
> As long as activities are saving and restoring properly it could be
made pretty much transparent to the user. Of course that's easier
said then done...
Android has a whole mechanism for this:
That explains the problem, but doesn't explain the Android answer
to it, which is here:
The section "Component Lifecycles" gives the summary. They call each
app's onPause() method when it is obscured from visibility on the
screen, and that method is responsible for recording everything the
app needs to restart itself and get back to the same screen display
(what file it was working on, how far down the file it was, etc).
Then, any process whose onPause() method has been called is considered
a cache, and can be killed without warning by the kernel.
(I'm not advocating using this system -- I've only barely been
exposed to it. But it's useful to see how others have solved the
problem you're facing, before making your own solutions.)
More information about the Devel