I suggest you don't use singleTask. And very strongly suggest you don't use singleInstance. These are for very specialized cases, and at the very least if your app isn't being launched from other apps it makes little sense to use them and is likely to cause you trouble.
On Tue, Mar 30, 2010 at 10:49 PM, focuser <[email protected]> wrote: > Hi, > > I have an app with two activities, one of which the launchmode is set > to "singleTask". From the Android dev guide, I got the impression > that my SingleTaskActivity should start a new task (or reuse an old > task) and always sit at the root of the stack when launched. However, > it's inconsistent with the behavior of the app if I follow the steps > below: > - launch StandardActivity from home > - click the "home" key > - launch SingleTaskActivity from home, you will see it's in the > foreground as expected > - click the "Back" key, StandardActivity comes to the foreground > whereas I expect to see the home screen because SingleTaskActivity is > supposed to be at the ROOT of the stack. It appears > SingleTaskActivity was launched into the task that StandardActivity > started, rather than starting its own task. > > Is my understanding about the "singleTask" launch mode correct? > Thanks, > > - > > PS: > > === The Android Dev guide (http://developer.android.com/guide/topics/ > manifest/activity-element.html#lmode) says: > > In contrast, "singleTask" and "singleInstance" activities can only > begin a task. They are always at the root of the activity stack. > Moreover, the device can hold only one instance of the activity at a > time — only one such task. > > === My AndroidManifest.xml file: > <application android:icon="@drawable/icon" android:label="@string/ > app_name"> > <activity android:name=".StandardActivity" > android:label="Standard"> > <intent-filter> > <action android:name="android.intent.action.MAIN" /> > <category > android:name="android.intent.category.LAUNCHER" /> > </intent-filter> > </activity> > <activity android:name=".SingleTaskActivity" > android:label="ActivitySingleTask" > android:launchMode="singleTask" > > > <intent-filter> > <action android:name="android.intent.action.MAIN" /> > <category > android:name="android.intent.category.LAUNCHER" /> > </intent-filter> > </activity> > </application> > > -- > 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]<android-developers%[email protected]> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > > To unsubscribe, reply using "remove me" as the subject. > -- Dianne Hackborn Android framework engineer [email protected] Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. 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 [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

