Thanks Dianne,

What I would like to achieve is to launch SingleTaskActivity in a
different task than the one StandardActivity started when user clicks
the home shortcut of SingleTaskActivty.  However, when
SingleTaskActivity is launched by StandardActivity, it is OK to leave
them in the same task.

If "singleTask" is not recommended, what is the best approach?

Also, do you acknowledge the inconsistency of the dev guide I found
about "singleTask"?


On Wed, Mar 31, 2010 at 12:19 AM, Dianne Hackborn <hack...@android.com> wrote:
> 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 <linto...@gmail.com> 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 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
>>
>> To unsubscribe, reply using "remove me" as the subject.
>
>
>
> --
> 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, 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 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

-- 
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

Reply via email to