As I understand it you are right, you need to react to onPause in each
activity (see also onSaveInstanceState()).

The reason behind this is an end-user Task can comprise more than one
Applicaton/Process with each Application consisting of more than one
Activity.


To give a made up example (which may not be possible with the actual
Andoid code base):

1) End-user starts MyApp with MyActivity1

2) In MyActivity1 the end-user selects somethings which starts
GoogleMaps / GoogleMapsActivity1 with some push pin data from MyApp.

3) End-user selects on of the push-pins that causes Google Maps to
start MyActivity2 (in MyApp).

So now we have

MyApp          MyActivity
GoogleMaps     GoogleMapsActivity1
MyApp          MyActivity2

4) MyApp/MyActivity2 could now display a web page etc.


Any Application/Process which is not the current forground Activity is
a candidate to be killed by the OS if resources get tight. So each
Activity that pauses needs to save its state so that when the end-user
presses the back key it can restore itself and resume where it left
off.

--
RichardC

On Oct 9, 6:22 pm, David Bernstein <[email protected]> wrote:
> How can an application detect when it's lost control of the screen?
> The reason I ask is that my application has an appwidget whose visible
> state should be consistent with user actions within the application.
> In addition to the application exiting, I'd like to know when other
> applications take over the screen.
>
> Simply noticing in onPause() in the root activity isn't enough because
> the user can, for example, press the home key or receive a phone
> call.  Noticing in onPause() in every single activity is overkill
> because the user will move between multiple activities in the same
> application.
>
> If this is documented or discussed already, I'll humbly accept an RTFM
> pointer, but I didn't find anything when I looked.
>
> Thanks.
--~--~---------~--~----~------------~-------~--~----~
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