Well, I DO think that Android documentation speaks about tasks and
their affinities, contrary to what I said previously :)
I defined a non-default value for the taskAffinity attribute of the
activity in question:
<activity android:name=".SingleTaskActivity"
android:label="ChildActivity:SingleTaskActivity"
android:launchMode="singleTask"
android:taskAffinity="com.robosoft.example.taskByIteself">
</activity>
and the activity gets to run in a separate task.
Both 'taskAffinity' and 'launchMode' are necessary if we want to have
an activity run in a separate task. Alternatively,
Intent.FLAG_ACTIVITY_NEW_TASK may be used in the intent, in case only
'taskAffinity' is mentioned in the manifest.
This is really interesting :)
On Sat, May 2, 2009 at 1:37 PM, devi prasad <[email protected]> wrote:
> Hi, Dianne: this is the portion of the dump that I get by executing
> "adb shell dumpsys activity" :
> ----------------------
> Activities in Current Activity Manager State:
> Task{3 com.robosoft.example}
> clearOnBackground=false numActivities=3 rootWasReset=true
> affinity=com.robosoft.example
> intent=Intent { action=android.intent.action.MAIN
> categories={android.intent.category.LAUNCHER}
> flags=0x10200000
>
> comp={com.robosoft.example/com.robosoft.example.AppRootActivity} }
>
> History #3:
> HistoryRecord{434d2090
> {com.robosoft.example/com.robosoft.example.SingleTaskActivity}}
> packageName=com.robosoft.example processName=com.robosoft.example
> app=ProcessRecord{43516130 181:com.robosoft.example/10018}
> Intent { flags=0x10000000
> comp={com.robosoft.example/com.robosoft.example.SingleTaskActivity} }
>
> History #2:
> HistoryRecord{434fb848
> {com.robosoft.example/com.robosoft.example.ChildActivityOfRoot}}
> packageName=com.robosoft.example processName=com.robosoft.example
> app=ProcessRecord{43516130 181:com.robosoft.example/10018}
> Intent {
> comp={com.robosoft.example/com.robosoft.example.ChildActivityOfRoot} }
>
> History #1:
> HistoryRecord{434fe2e8
> {com.robosoft.example/com.robosoft.example.AppRootActivity}}
> packageName=com.robosoft.example processName=com.robosoft.example
> app=ProcessRecord{43516130 181:com.robosoft.example/10018}
> Intent { action=android.intent.action.MAIN
> categories={android.intent.category.LAUNCHER}
> ---------------------------------------
> As I gather, this shows that all three activities are part of the same
> task, even though I use FLAG_ACTIVITY_NEW_TASK while starting
> 'SingleTaskActivity' and mark it with 'singleTask' launch mode. The
> intent flag value (0x10000000) indicates this in the top most activity
> entry above.
>
> I cannot explain this behavior with my current understanding derived
> from the documentation. What am I missing here?
>
> thanks
>
>
> On Sat, May 2, 2009 at 10:50 AM, devi prasad <[email protected]> wrote:
>> Hi, Dianne: ok, thanks.
>> I use the following functions to determine the task id and if it is
>> the root of a task:
>>
>> activity.getTaskId();
>> activity.isTaskRoot();
>>
>> I used logcat looking for useful hints. Let me see if I understand it
>> better if I use
>> "adb shell dumpsys activity"
>>
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---