On Tue, Mar 3, 2009 at 6:01 AM, ellipsoidmob...@googlemail.com < ellipsoidmob...@googlemail.com> wrote:
> For my application, I only ever want a single instance to run and I > only ever want a single instance to exist of my main activity class. > If the user navigates away from my app (e.g. by pressing the home key) > then if it hasn't been destroyed by the system I'd like the user to go > back to the same instance when they click on the application from the > homescreen. That last scenario is the normal behavior. > I read the app fundementals section (several times!) and I think this > means I should specify singleTask. Not unless you want more than just what you described about pressing home and later returning to the app. > However - in practise everything seems to work in the way I want just > using the default settings (standard mode). If I leave the application > (e.g. on a settings menu in a sub activity) then when I click back on > the application from the homescreen I go back to the activity I left. Yep. > I assume that this is because when you launch an app from the > homescreen the system is using the FLAG_ACTIVITY_NEW_TASK flag, > causing it to reattach to my existing instance? Correct. > So - my question is, why is singleTask needed? I can't see any way > that users could end up with two instances of a standard mode > application running anyway? If your activity is launched from another application, without using single task, but you want this to cause your current app to come to the foreground instead of a new instance of that activity started in the other app's task. An example of an app that does this is the browser. -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---