[android-developers] Re: Task activity stack always reset when launched from Home
On Mar 2, 5:22 am, Neha wrote: > I have tried launching OtherActivity from SingleTaskActivity in both > these ways: > Intent explicitIntent = new Intent(this, OtherActivity.class); > explicitIntent.setComponent(new ComponentName(this, > OtherActivity.class)); > startActivityForResult(explicitIntent, 0); > > Intent implicitIntent = new Intent(Intent.ACTION_VIEW); > implicitIntent.addCategory("com.sample.singletask.category.FOO"); > startActivityForResult(implicitIntent, 0); > > OtherActivity is popped off the stack in both cases. > > Am I missing something? > The case that works is if you remove the intent_filter completely from OtherActivty and invoke it with an explicit intent. -- 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
[android-developers] Re: Task activity stack always reset when launched from Home
Thanks a lot for your reply! I'm seeing the same behavior when I launch my second Activity (say B) by providing the component name or by using an intent-filter (custom category). In both cases, Activity B is popped from the stack after returning from HOME. My AndroidManifest.xml looks like this: http://schemas.android.com/apk/res/android"; package="com.sample.singletask" android:versionCode="1" android:versionName="1.0"> I have tried launching OtherActivity from SingleTaskActivity in both these ways: Intent explicitIntent = new Intent(this, OtherActivity.class); explicitIntent.setComponent(new ComponentName(this, OtherActivity.class)); startActivityForResult(explicitIntent, 0); Intent implicitIntent = new Intent(Intent.ACTION_VIEW); implicitIntent.addCategory("com.sample.singletask.category.FOO"); startActivityForResult(implicitIntent, 0); OtherActivity is popped off the stack in both cases. Am I missing something? On Feb 27, 1:35 am, jotobjects wrote: > There was another thread about this recently. This message summarizes > the behavior withsingleTask > > http://groups.google.com/group/android-developers/msg/471bef9e235f6c65 > > In short, with launchMode=singleTaskthe behavior after re-visiting > Home is different depending on whether the activity at the top of the > stack was started implicitly (with an intent filter) or explicitly > (with a class name). ASFAIK this is not documented. Not clear if it > is a bug or not. > > On Feb 26, 1:05 am, Neha wrote: > > > Hi, > > > Does anyone have any updates on this issue? I'm facing the same > > problem with my activity when launchMode=singleTask. > > - Launcher -> Activity A (singleTask) -> Activity B (standard) > > - Press HOME > > - Long-press HOME or go to Launcher > > - Activity A (B's onDestroy called) > > > "adb shell dumpsys activity" shows only Activity A in the stack for > > this task. The intent flags are: > > Long press HOME - FLAG_ACTIVITY_NEW_TASK, > > FLAG_ACTIVITY_BROUGHT_TO_FRONT and FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY > > Launcher - FLAG_ACTIVITY_NEW_TASK, FLAG_ACTIVITY_BROUGHT_TO_FRONT and > > FLAG_ACTIVITY_RESET_TASK_IF_NEEDED > > > Any pointers on how to fix this would be helpful. > > Thanks! > > > On Feb 17, 10:41 pm, Dianne Hackborn wrote: > > > > When you say "launch" do you mean launching from Eclipse? If so, there > > > is a > > > bug in older SDKs where this would use the wrong intent so when you later > > > launch it from the launcher you would get a new task. > > > > You can use "adb shell dumpsys activity" to see the current state of the > > > activity stack at whatever point you want to help diagnose what is going > > > on. > > > > On Thu, Mar 26, 2009 at 8:55 AM, jseghers wrote: > > > > > The code that starts the .About activity is: > > > > protected void startAbout() > > > > { > > > > Intent aIntent = new Intent(this, About.class); > > > > startActivity(aIntent); > > > > } > > > > > The Manifest entries for .UserLaunch and .About are in my original > > > > post. > > > > The intent that returns the task to the front is generated by the > > > > Launcher. > > > > > What flags do I need to set (and where) to prevent this from > > > > happening? Is one of the default values causing it? > > > > > My test case here is: > > > > 1) launch .UserLaunch from the launcher > > > > 2) start .About > > > > 3) hit Home key > > > > 4) launch .UserLuanch from the launcher > > > > > There are no long delays in any of this, so the 30 minute auto-clear > > > > should not be invoked. > > > > > - John > > > > > On Mar 25, 12:15 pm, Dianne Hackborn wrote: > > > > > That means you are using some CLEAR_TOP or finish flag in an intent > > > > > or in > > > > > the manifest. Or possibly it has been > 30 minutes since the app was > > > > last > > > > > launched, in which case the system will restart it automatically. > > > > > > On Wed, Mar 25, 2009 at 11:12 AM, jseghers > > > > > wrote: > > > > > > > Thank you for your reply! > > > > > > > I am seeing am_task_to_front followed by am_finish_activity. > > > > > > I found the event-log-tags file and apparently the reason is > > > > > > "clear". > > > > > > What is not clear to me though is why the activity manager thinks it > > > > > > should clear the the task. > > > > > > > The relevant lines of the log are: > > > > > > I/am_on_resume_called( 94): com.android.launcher.Launcher > > > > > > I/dvm_gc_info( 94): > > > > > > [7017575181485176104,-9053780441931634733,-4010030953047537782,8554533] > > > > > > I/force_gc( 209): bg > > > > > > I/dvm_gc_info( 209): > > > > > > [7163384747111232651,-9098816781953771608,-4017912252395432053,7919391] > > > > > > I/am_pause_activity( 52): > > > > > > [1128800640,com.android.launcher/.Launcher] > > > > > > I/am_task_to_front( 52): 3 > > >
[android-developers] Re: Task activity stack always reset when launched from Home
There was another thread about this recently. This message summarizes the behavior with singleTask http://groups.google.com/group/android-developers/msg/471bef9e235f6c65 In short, with launchMode=singleTask the behavior after re-visiting Home is different depending on whether the activity at the top of the stack was started implicitly (with an intent filter) or explicitly (with a class name). ASFAIK this is not documented. Not clear if it is a bug or not. On Feb 26, 1:05 am, Neha wrote: > Hi, > > Does anyone have any updates on this issue? I'm facing the same > problem with my activity when launchMode=singleTask. > - Launcher -> Activity A (singleTask) -> Activity B (standard) > - Press HOME > - Long-press HOME or go to Launcher > - Activity A (B's onDestroy called) > > "adb shell dumpsys activity" shows only Activity A in the stack for > this task. The intent flags are: > Long press HOME - FLAG_ACTIVITY_NEW_TASK, > FLAG_ACTIVITY_BROUGHT_TO_FRONT and FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY > Launcher - FLAG_ACTIVITY_NEW_TASK, FLAG_ACTIVITY_BROUGHT_TO_FRONT and > FLAG_ACTIVITY_RESET_TASK_IF_NEEDED > > Any pointers on how to fix this would be helpful. > Thanks! > > On Feb 17, 10:41 pm, Dianne Hackborn wrote: > > > When you say "launch" do you mean launching from Eclipse? If so, there is a > > bug in older SDKs where this would use the wrong intent so when you later > > launch it from the launcher you would get a new task. > > > You can use "adb shell dumpsys activity" to see the current state of the > > activity stack at whatever point you want to help diagnose what is going on. > > > On Thu, Mar 26, 2009 at 8:55 AM, jseghers wrote: > > > > The code that starts the .About activity is: > > > protected void startAbout() > > > { > > > Intent aIntent = new Intent(this, About.class); > > > startActivity(aIntent); > > > } > > > > The Manifest entries for .UserLaunch and .About are in my original > > > post. > > > The intent that returns the task to the front is generated by the > > > Launcher. > > > > What flags do I need to set (and where) to prevent this from > > > happening? Is one of the default values causing it? > > > > My test case here is: > > > 1) launch .UserLaunch from the launcher > > > 2) start .About > > > 3) hit Home key > > > 4) launch .UserLuanch from the launcher > > > > There are no long delays in any of this, so the 30 minute auto-clear > > > should not be invoked. > > > > - John > > > > On Mar 25, 12:15 pm, Dianne Hackborn wrote: > > > > That means you are using some CLEAR_TOP or finish flag in an intent or > > > > in > > > > the manifest. Or possibly it has been > 30 minutes since the app was > > > last > > > > launched, in which case the system will restart it automatically. > > > > > On Wed, Mar 25, 2009 at 11:12 AM, jseghers wrote: > > > > > > Thank you for your reply! > > > > > > I am seeing am_task_to_front followed by am_finish_activity. > > > > > I found the event-log-tags file and apparently the reason is "clear". > > > > > What is not clear to me though is why the activity manager thinks it > > > > > should clear the the task. > > > > > > The relevant lines of the log are: > > > > > I/am_on_resume_called( 94): com.android.launcher.Launcher > > > > > I/dvm_gc_info( 94): > > > > > [7017575181485176104,-9053780441931634733,-4010030953047537782,8554533] > > > > > I/force_gc( 209): bg > > > > > I/dvm_gc_info( 209): > > > > > [7163384747111232651,-9098816781953771608,-4017912252395432053,7919391] > > > > > I/am_pause_activity( 52): > > > > > [1128800640,com.android.launcher/.Launcher] > > > > > I/am_task_to_front( 52): 3 > > > > > I/am_finish_activity( 52): > > > > > [1129575992,3,com.cequint.cityid/.About,clear] > > > > > I/am_destroy_activity( 52): [1129575992,3,com.cequint.cityid/.About] > > > > > I/am_new_intent( 52): > > > > [112951,3,com.cequint.cityid/.UserLaunch,android.intent.action.MAIN,,, > > > > > 274726912] > > > > > I/am_on_paused_called( 94): com.android.launcher.Launcher > > > > > I/am_resume_activity( 52): > > > > > [1129749080,3,com.cequint.cityid/.UserLaunch] > > > > > I/am_on_resume_called( 209): com.cequint.cityid.UserLaunch > > > > > I/dvm_gc_madvise_info( 94): [290816,245760] > > > > > I/dvm_gc_madvise_info( 209): [352256,241664] > > > > > I/force_gc( 94): bg > > > > > > - John > > > > > On Mar 25, 10:16 am, Dianne Hackborn wrote: > > > > > > You can do "adb logcat -b events" to see the event log which will > > > include > > > > > a > > > > > > line the activity manager prints when finishing an activity, with > > > > > > the > > > > > reason > > > > > > why it is doing it. > > > > > > > On Tue, Mar 24, 2009 at 7:24 PM, jseghers > > > wrote: > > > > > > > > I am just starting on an Android app and I am puzzled about why my > > > > > > > Task activity stack is being reset any time the application is > > > > > > > launched from the Home screen. > > > > > > > > I used the ADT tools to create the applic
[android-developers] Re: Task activity stack always reset when launched from Home
Hi, Does anyone have any updates on this issue? I'm facing the same problem with my activity when launchMode=singleTask. - Launcher -> Activity A (singleTask) -> Activity B (standard) - Press HOME - Long-press HOME or go to Launcher - Activity A (B's onDestroy called) "adb shell dumpsys activity" shows only Activity A in the stack for this task. The intent flags are: Long press HOME - FLAG_ACTIVITY_NEW_TASK, FLAG_ACTIVITY_BROUGHT_TO_FRONT and FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY Launcher - FLAG_ACTIVITY_NEW_TASK, FLAG_ACTIVITY_BROUGHT_TO_FRONT and FLAG_ACTIVITY_RESET_TASK_IF_NEEDED Any pointers on how to fix this would be helpful. Thanks! On Feb 17, 10:41 pm, Dianne Hackborn wrote: > When you say "launch" do you mean launching from Eclipse? If so, there is a > bug in older SDKs where this would use the wrong intent so when you later > launch it from the launcher you would get a new task. > > You can use "adb shell dumpsys activity" to see the current state of the > activity stack at whatever point you want to help diagnose what is going on. > > > > On Thu, Mar 26, 2009 at 8:55 AM, jseghers wrote: > > > The code that starts the .About activity is: > > protected void startAbout() > > { > > Intent aIntent = new Intent(this, About.class); > > startActivity(aIntent); > > } > > > The Manifest entries for .UserLaunch and .About are in my original > > post. > > The intent that returns the task to the front is generated by the > > Launcher. > > > What flags do I need to set (and where) to prevent this from > > happening? Is one of the default values causing it? > > > My test case here is: > > 1) launch .UserLaunch from the launcher > > 2) start .About > > 3) hit Home key > > 4) launch .UserLuanch from the launcher > > > There are no long delays in any of this, so the 30 minute auto-clear > > should not be invoked. > > > - John > > > On Mar 25, 12:15 pm, Dianne Hackborn wrote: > > > That means you are using some CLEAR_TOP or finish flag in an intent or in > > > the manifest. Or possibly it has been > 30 minutes since the app was > > last > > > launched, in which case the system will restart it automatically. > > > > On Wed, Mar 25, 2009 at 11:12 AM, jseghers wrote: > > > > > Thank you for your reply! > > > > > I am seeing am_task_to_front followed by am_finish_activity. > > > > I found the event-log-tags file and apparently the reason is "clear". > > > > What is not clear to me though is why the activity manager thinks it > > > > should clear the the task. > > > > > The relevant lines of the log are: > > > > I/am_on_resume_called( 94): com.android.launcher.Launcher > > > > I/dvm_gc_info( 94): > > > > [7017575181485176104,-9053780441931634733,-4010030953047537782,8554533] > > > > I/force_gc( 209): bg > > > > I/dvm_gc_info( 209): > > > > [7163384747111232651,-9098816781953771608,-4017912252395432053,7919391] > > > > I/am_pause_activity( 52): > > > > [1128800640,com.android.launcher/.Launcher] > > > > I/am_task_to_front( 52): 3 > > > > I/am_finish_activity( 52): > > > > [1129575992,3,com.cequint.cityid/.About,clear] > > > > I/am_destroy_activity( 52): [1129575992,3,com.cequint.cityid/.About] > > > > I/am_new_intent( 52): > > > [112951,3,com.cequint.cityid/.UserLaunch,android.intent.action.MAIN,,, > > > > 274726912] > > > > I/am_on_paused_called( 94): com.android.launcher.Launcher > > > > I/am_resume_activity( 52): > > > > [1129749080,3,com.cequint.cityid/.UserLaunch] > > > > I/am_on_resume_called( 209): com.cequint.cityid.UserLaunch > > > > I/dvm_gc_madvise_info( 94): [290816,245760] > > > > I/dvm_gc_madvise_info( 209): [352256,241664] > > > > I/force_gc( 94): bg > > > > > - John > > > > On Mar 25, 10:16 am, Dianne Hackborn wrote: > > > > > You can do "adb logcat -b events" to see the event log which will > > include > > > > a > > > > > line the activity manager prints when finishing an activity, with the > > > > reason > > > > > why it is doing it. > > > > > > On Tue, Mar 24, 2009 at 7:24 PM, jseghers > > wrote: > > > > > > > I am just starting on an Android app and I am puzzled about why my > > > > > > Task activity stack is being reset any time the application is > > > > > > launched from the Home screen. > > > > > > > I used the ADT tools to create the application in Eclipse. > > > > > > The main activity is ".UserLaunch" and it starts the activity > > ".About" > > > > > > when the user presses a button. > > > > > > If the user then presses HOME and then relaunches the app, > > .UserLaunch > > > > > > is displayed and is the only thing on the stack. > > > > > > > .UserLaunch has the launchMode singleTask. .About is standard. > > > > > > According to the documentation at > > > > > >http://developer.android.com/guide/topics/fundamentals.html#lmodes: > > > > > > > "However, a "singleTask" activity may or may not have other > > > > > > activities above it in the stack. If it does, it is not in position > > to > > > > > > handle the intent, and the i
Re: [android-developers] Re: Task activity stack always reset when launched from Home
When you say "launch" do you mean launching from Eclipse? If so, there is a bug in older SDKs where this would use the wrong intent so when you later launch it from the launcher you would get a new task. You can use "adb shell dumpsys activity" to see the current state of the activity stack at whatever point you want to help diagnose what is going on. On Thu, Mar 26, 2009 at 8:55 AM, jseghers wrote: > > The code that starts the .About activity is: >protected void startAbout() >{ >Intent aIntent = new Intent(this, About.class); >startActivity(aIntent); >} > > The Manifest entries for .UserLaunch and .About are in my original > post. > The intent that returns the task to the front is generated by the > Launcher. > > What flags do I need to set (and where) to prevent this from > happening? Is one of the default values causing it? > > My test case here is: > 1) launch .UserLaunch from the launcher > 2) start .About > 3) hit Home key > 4) launch .UserLuanch from the launcher > > There are no long delays in any of this, so the 30 minute auto-clear > should not be invoked. > > - John > > > On Mar 25, 12:15 pm, Dianne Hackborn wrote: > > That means you are using some CLEAR_TOP or finish flag in an intent or in > > the manifest. Or possibly it has been > 30 minutes since the app was > last > > launched, in which case the system will restart it automatically. > > > > > > > > > > > > On Wed, Mar 25, 2009 at 11:12 AM, jseghers wrote: > > > > > Thank you for your reply! > > > > > I am seeing am_task_to_front followed by am_finish_activity. > > > I found the event-log-tags file and apparently the reason is "clear". > > > What is not clear to me though is why the activity manager thinks it > > > should clear the the task. > > > > > The relevant lines of the log are: > > > I/am_on_resume_called( 94): com.android.launcher.Launcher > > > I/dvm_gc_info( 94): > > > [7017575181485176104,-9053780441931634733,-4010030953047537782,8554533] > > > I/force_gc( 209): bg > > > I/dvm_gc_info( 209): > > > [7163384747111232651,-9098816781953771608,-4017912252395432053,7919391] > > > I/am_pause_activity( 52): > > > [1128800640,com.android.launcher/.Launcher] > > > I/am_task_to_front( 52): 3 > > > I/am_finish_activity( 52): > > > [1129575992,3,com.cequint.cityid/.About,clear] > > > I/am_destroy_activity( 52): [1129575992,3,com.cequint.cityid/.About] > > > I/am_new_intent( 52): > > > > [112951,3,com.cequint.cityid/.UserLaunch,android.intent.action.MAIN,,, > > > 274726912] > > > I/am_on_paused_called( 94): com.android.launcher.Launcher > > > I/am_resume_activity( 52): > > > [1129749080,3,com.cequint.cityid/.UserLaunch] > > > I/am_on_resume_called( 209): com.cequint.cityid.UserLaunch > > > I/dvm_gc_madvise_info( 94): [290816,245760] > > > I/dvm_gc_madvise_info( 209): [352256,241664] > > > I/force_gc( 94): bg > > > > > - John > > > On Mar 25, 10:16 am, Dianne Hackborn wrote: > > > > You can do "adb logcat -b events" to see the event log which will > include > > > a > > > > line the activity manager prints when finishing an activity, with the > > > reason > > > > why it is doing it. > > > > > > On Tue, Mar 24, 2009 at 7:24 PM, jseghers > wrote: > > > > > > > I am just starting on an Android app and I am puzzled about why my > > > > > Task activity stack is being reset any time the application is > > > > > launched from the Home screen. > > > > > > > I used the ADT tools to create the application in Eclipse. > > > > > The main activity is ".UserLaunch" and it starts the activity > ".About" > > > > > when the user presses a button. > > > > > If the user then presses HOME and then relaunches the app, > .UserLaunch > > > > > is displayed and is the only thing on the stack. > > > > > > > .UserLaunch has the launchMode singleTask. .About is standard. > > > > > According to the documentation at > > > > >http://developer.android.com/guide/topics/fundamentals.html#lmodes: > > > > > > >"However, a "singleTask" activity may or may not have other > > > > > activities above it in the stack. If it does, it is not in position > to > > > > > handle the intent, and the intent is dropped. (Even though the > intent > > > > > is dropped, its arrival would have caused the task to come to the > > > > > foreground, where it would remain.) " > > > > > > > The Task stack should be brought to the foreground and .About > should > > > > > still be displayed. > > > > > > > I added Logging to all of the lifecycle events (edited to remove > > > > > timestamps and shorten DEBUG/ and INFO/ to D/ and I/) and you can > see > > > > > that when HOME is pressed, .About cycles through onPause and onStop > > > > > (as expected). Then when the app is again launched, .About is > > > > > destroyed and .UserLaunch is restarted > > > > > > > D/UserLaunch:(670): onCreate() > > > > > D/UserLaunch:(670): onStart() > > > > > D/UserLaunch:(670): onResume() > > > > > I/ActivityManager(52): Displayed activity > > > > > com.
[android-developers] Re: Task activity stack always reset when launched from Home
I'm facing same issue. Did you got any fix or work around for this ? On Mar 26, 6:55 pm, jseghers wrote: > The code that starts the .About activity is: > protected void startAbout() > { > Intent aIntent = new Intent(this, About.class); > startActivity(aIntent); > } > > The Manifest entries for .UserLaunch and .About are in my original > post. > The intent that returns the task to the front is generated by the > Launcher. > > What flags do I need to set (and where) to prevent this from > happening? Is one of the default values causing it? > > My test case here is: > 1) launch .UserLaunch from the launcher > 2) start .About > 3) hit Home key > 4) launch .UserLuanch from the launcher > > There are no long delays in any of this, so the 30 minute auto-clear > should not be invoked. > > - John > > On Mar 25, 12:15 pm, Dianne Hackborn wrote: > > > That means you are using some CLEAR_TOP or finish flag in an intent or in > > the manifest. Or possibly it has been > 30 minutes since the app was last > > launched, in which case the system will restart it automatically. > > > On Wed, Mar 25, 2009 at 11:12 AM, jseghers wrote: > > > > Thank you for your reply! > > > > I am seeing am_task_to_front followed by am_finish_activity. > > > I found the event-log-tags file and apparently the reason is "clear". > > > What is not clear to me though is why the activity manager thinks it > > > should clear the the task. > > > > The relevant lines of the log are: > > > I/am_on_resume_called( 94): com.android.launcher.Launcher > > > I/dvm_gc_info( 94): > > > [7017575181485176104,-9053780441931634733,-4010030953047537782,8554533] > > > I/force_gc( 209): bg > > > I/dvm_gc_info( 209): > > > [7163384747111232651,-9098816781953771608,-4017912252395432053,7919391] > > > I/am_pause_activity( 52): > > > [1128800640,com.android.launcher/.Launcher] > > > I/am_task_to_front( 52): 3 > > > I/am_finish_activity( 52): > > > [1129575992,3,com.cequint.cityid/.About,clear] > > > I/am_destroy_activity( 52): [1129575992,3,com.cequint.cityid/.About] > > > I/am_new_intent( 52): > > > [112951,3,com.cequint.cityid/.UserLaunch,android.intent.action.MAIN,,, > > > 274726912] > > > I/am_on_paused_called( 94): com.android.launcher.Launcher > > > I/am_resume_activity( 52): > > > [1129749080,3,com.cequint.cityid/.UserLaunch] > > > I/am_on_resume_called( 209): com.cequint.cityid.UserLaunch > > > I/dvm_gc_madvise_info( 94): [290816,245760] > > > I/dvm_gc_madvise_info( 209): [352256,241664] > > > I/force_gc( 94): bg > > > > - John > > > On Mar 25, 10:16 am, Dianne Hackborn wrote: > > > > You can do "adb logcat -b events" to see the event log which will > > > > include > > > a > > > > line the activity manager prints when finishing an activity, with the > > > reason > > > > why it is doing it. > > > > > On Tue, Mar 24, 2009 at 7:24 PM, jseghers wrote: > > > > > > I am just starting on an Android app and I am puzzled about why my > > > > > Task activity stack is being reset any time the application is > > > > > launched from the Home screen. > > > > > > I used the ADT tools to create the application in Eclipse. > > > > > The main activity is ".UserLaunch" and it starts the activity ".About" > > > > > when the user presses a button. > > > > > If the user then presses HOME and then relaunches the app, .UserLaunch > > > > > is displayed and is the only thing on the stack. > > > > > > .UserLaunch has the launchMode singleTask. .About is standard. > > > > > According to the documentation at > > > > >http://developer.android.com/guide/topics/fundamentals.html#lmodes: > > > > > > "However, a "singleTask" activity may or may not have other > > > > > activities above it in the stack. If it does, it is not in position to > > > > > handle the intent, and the intent is dropped. (Even though the intent > > > > > is dropped, its arrival would have caused the task to come to the > > > > > foreground, where it would remain.) " > > > > > > The Task stack should be brought to the foreground and .About should > > > > > still be displayed. > > > > > > I added Logging to all of the lifecycle events (edited to remove > > > > > timestamps and shorten DEBUG/ and INFO/ to D/ and I/) and you can see > > > > > that when HOME is pressed, .About cycles through onPause and onStop > > > > > (as expected). Then when the app is again launched, .About is > > > > > destroyed and .UserLaunch is restarted > > > > > > D/UserLaunch:(670): onCreate() > > > > > D/UserLaunch:(670): onStart() > > > > > D/UserLaunch:(670): onResume() > > > > > I/ActivityManager(52): Displayed activity > > > > > com.cequint.cityid/.UserLaunch: 4910 ms > > > > > I/ActivityManager(52): Starting activity: Intent { comp= > > > > > {com.cequint.cityid/com.cequint.cityid.About} } > > > > > D/UserLaunch:(670): onPause() > > > > > D/About(670): onCreate() > > > > > D/About(670): onStart() > > > > > D/About(670): onResume() > > > > > I/ActivityManager(52): Displayed
[android-developers] Re: Task activity stack always reset when launched from Home
The code that starts the .About activity is: protected void startAbout() { Intent aIntent = new Intent(this, About.class); startActivity(aIntent); } The Manifest entries for .UserLaunch and .About are in my original post. The intent that returns the task to the front is generated by the Launcher. What flags do I need to set (and where) to prevent this from happening? Is one of the default values causing it? My test case here is: 1) launch .UserLaunch from the launcher 2) start .About 3) hit Home key 4) launch .UserLuanch from the launcher There are no long delays in any of this, so the 30 minute auto-clear should not be invoked. - John On Mar 25, 12:15 pm, Dianne Hackborn wrote: > That means you are using some CLEAR_TOP or finish flag in an intent or in > the manifest. Or possibly it has been > 30 minutes since the app was last > launched, in which case the system will restart it automatically. > > > > > > On Wed, Mar 25, 2009 at 11:12 AM, jseghers wrote: > > > Thank you for your reply! > > > I am seeing am_task_to_front followed by am_finish_activity. > > I found the event-log-tags file and apparently the reason is "clear". > > What is not clear to me though is why the activity manager thinks it > > should clear the the task. > > > The relevant lines of the log are: > > I/am_on_resume_called( 94): com.android.launcher.Launcher > > I/dvm_gc_info( 94): > > [7017575181485176104,-9053780441931634733,-4010030953047537782,8554533] > > I/force_gc( 209): bg > > I/dvm_gc_info( 209): > > [7163384747111232651,-9098816781953771608,-4017912252395432053,7919391] > > I/am_pause_activity( 52): > > [1128800640,com.android.launcher/.Launcher] > > I/am_task_to_front( 52): 3 > > I/am_finish_activity( 52): > > [1129575992,3,com.cequint.cityid/.About,clear] > > I/am_destroy_activity( 52): [1129575992,3,com.cequint.cityid/.About] > > I/am_new_intent( 52): > > [112951,3,com.cequint.cityid/.UserLaunch,android.intent.action.MAIN,,, > > 274726912] > > I/am_on_paused_called( 94): com.android.launcher.Launcher > > I/am_resume_activity( 52): > > [1129749080,3,com.cequint.cityid/.UserLaunch] > > I/am_on_resume_called( 209): com.cequint.cityid.UserLaunch > > I/dvm_gc_madvise_info( 94): [290816,245760] > > I/dvm_gc_madvise_info( 209): [352256,241664] > > I/force_gc( 94): bg > > > - John > > On Mar 25, 10:16 am, Dianne Hackborn wrote: > > > You can do "adb logcat -b events" to see the event log which will include > > a > > > line the activity manager prints when finishing an activity, with the > > reason > > > why it is doing it. > > > > On Tue, Mar 24, 2009 at 7:24 PM, jseghers wrote: > > > > > I am just starting on an Android app and I am puzzled about why my > > > > Task activity stack is being reset any time the application is > > > > launched from the Home screen. > > > > > I used the ADT tools to create the application in Eclipse. > > > > The main activity is ".UserLaunch" and it starts the activity ".About" > > > > when the user presses a button. > > > > If the user then presses HOME and then relaunches the app, .UserLaunch > > > > is displayed and is the only thing on the stack. > > > > > .UserLaunch has the launchMode singleTask. .About is standard. > > > > According to the documentation at > > > >http://developer.android.com/guide/topics/fundamentals.html#lmodes: > > > > > "However, a "singleTask" activity may or may not have other > > > > activities above it in the stack. If it does, it is not in position to > > > > handle the intent, and the intent is dropped. (Even though the intent > > > > is dropped, its arrival would have caused the task to come to the > > > > foreground, where it would remain.) " > > > > > The Task stack should be brought to the foreground and .About should > > > > still be displayed. > > > > > I added Logging to all of the lifecycle events (edited to remove > > > > timestamps and shorten DEBUG/ and INFO/ to D/ and I/) and you can see > > > > that when HOME is pressed, .About cycles through onPause and onStop > > > > (as expected). Then when the app is again launched, .About is > > > > destroyed and .UserLaunch is restarted > > > > > D/UserLaunch:(670): onCreate() > > > > D/UserLaunch:(670): onStart() > > > > D/UserLaunch:(670): onResume() > > > > I/ActivityManager(52): Displayed activity > > > > com.cequint.cityid/.UserLaunch: 4910 ms > > > > I/ActivityManager(52): Starting activity: Intent { comp= > > > > {com.cequint.cityid/com.cequint.cityid.About} } > > > > D/UserLaunch:(670): onPause() > > > > D/About(670): onCreate() > > > > D/About(670): onStart() > > > > D/About(670): onResume() > > > > I/ActivityManager(52): Displayed activity com.cequint.cityid/.About: > > > > 1031 ms > > > > D/UserLaunch:(670): onStop() > > > > I/ActivityManager(52): Starting activity: Intent > > > > { action=android.intent.action.MAIN categories= > > > > {android.intent.category.HOME} flags=0x1020 comp= > > > > {com.android.launcher/com.android.lau
[android-developers] Re: Task activity stack always reset when launched from Home
That means you are using some CLEAR_TOP or finish flag in an intent or in the manifest. Or possibly it has been > 30 minutes since the app was last launched, in which case the system will restart it automatically. On Wed, Mar 25, 2009 at 11:12 AM, jseghers wrote: > > Thank you for your reply! > > I am seeing am_task_to_front followed by am_finish_activity. > I found the event-log-tags file and apparently the reason is "clear". > What is not clear to me though is why the activity manager thinks it > should clear the the task. > > The relevant lines of the log are: > I/am_on_resume_called( 94): com.android.launcher.Launcher > I/dvm_gc_info( 94): > [7017575181485176104,-9053780441931634733,-4010030953047537782,8554533] > I/force_gc( 209): bg > I/dvm_gc_info( 209): > [7163384747111232651,-9098816781953771608,-4017912252395432053,7919391] > I/am_pause_activity( 52): > [1128800640,com.android.launcher/.Launcher] > I/am_task_to_front( 52): 3 > I/am_finish_activity( 52): > [1129575992,3,com.cequint.cityid/.About,clear] > I/am_destroy_activity( 52): [1129575992,3,com.cequint.cityid/.About] > I/am_new_intent( 52): > [112951,3,com.cequint.cityid/.UserLaunch,android.intent.action.MAIN,,, > 274726912] > I/am_on_paused_called( 94): com.android.launcher.Launcher > I/am_resume_activity( 52): > [1129749080,3,com.cequint.cityid/.UserLaunch] > I/am_on_resume_called( 209): com.cequint.cityid.UserLaunch > I/dvm_gc_madvise_info( 94): [290816,245760] > I/dvm_gc_madvise_info( 209): [352256,241664] > I/force_gc( 94): bg > > - John > On Mar 25, 10:16 am, Dianne Hackborn wrote: > > You can do "adb logcat -b events" to see the event log which will include > a > > line the activity manager prints when finishing an activity, with the > reason > > why it is doing it. > > > > > > > > > > > > On Tue, Mar 24, 2009 at 7:24 PM, jseghers wrote: > > > > > I am just starting on an Android app and I am puzzled about why my > > > Task activity stack is being reset any time the application is > > > launched from the Home screen. > > > > > I used the ADT tools to create the application in Eclipse. > > > The main activity is ".UserLaunch" and it starts the activity ".About" > > > when the user presses a button. > > > If the user then presses HOME and then relaunches the app, .UserLaunch > > > is displayed and is the only thing on the stack. > > > > > .UserLaunch has the launchMode singleTask. .About is standard. > > > According to the documentation at > > >http://developer.android.com/guide/topics/fundamentals.html#lmodes: > > > > >"However, a "singleTask" activity may or may not have other > > > activities above it in the stack. If it does, it is not in position to > > > handle the intent, and the intent is dropped. (Even though the intent > > > is dropped, its arrival would have caused the task to come to the > > > foreground, where it would remain.) " > > > > > The Task stack should be brought to the foreground and .About should > > > still be displayed. > > > > > I added Logging to all of the lifecycle events (edited to remove > > > timestamps and shorten DEBUG/ and INFO/ to D/ and I/) and you can see > > > that when HOME is pressed, .About cycles through onPause and onStop > > > (as expected). Then when the app is again launched, .About is > > > destroyed and .UserLaunch is restarted > > > > > D/UserLaunch:(670): onCreate() > > > D/UserLaunch:(670): onStart() > > > D/UserLaunch:(670): onResume() > > > I/ActivityManager(52): Displayed activity > > > com.cequint.cityid/.UserLaunch: 4910 ms > > > I/ActivityManager(52): Starting activity: Intent { comp= > > > {com.cequint.cityid/com.cequint.cityid.About} } > > > D/UserLaunch:(670): onPause() > > > D/About(670): onCreate() > > > D/About(670): onStart() > > > D/About(670): onResume() > > > I/ActivityManager(52): Displayed activity com.cequint.cityid/.About: > > > 1031 ms > > > D/UserLaunch:(670): onStop() > > > I/ActivityManager(52): Starting activity: Intent > > > { action=android.intent.action.MAIN categories= > > > {android.intent.category.HOME} flags=0x1020 comp= > > > {com.android.launcher/com.android.launcher.Launcher} } > > > D/About(670): onPause() > > > D/About(670): onStop() > > > D/dalvikvm(670): GC freed 413 objects / 34128 bytes in 72ms > > > I/ActivityManager(52): Starting activity: Intent > > > { action=android.intent.action.MAIN categories= > > > {android.intent.category.LAUNCHER} flags=0x1020 comp= > > > {com.cequint.cityid/com.cequint.cityid.UserLaunch} } > > > D/About(670): onDestroy() > > > D/UserLaunch:(670): onRestart() > > > D/UserLaunch:(670): onStart() > > > D/UserLaunch:(670): onResume() > > > > > Here is the relevant section of the Manifest: > > > > > > > > > > android:launchMode="singleTask" > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Anyone have any ideas why this is always resetting the Activity Stack? > > > > -- > > Dianne Hackborn > > Android framework engineer > > hack...@android.com
[android-developers] Re: Task activity stack always reset when launched from Home
Thank you for your reply! I am seeing am_task_to_front followed by am_finish_activity. I found the event-log-tags file and apparently the reason is "clear". What is not clear to me though is why the activity manager thinks it should clear the the task. The relevant lines of the log are: I/am_on_resume_called( 94): com.android.launcher.Launcher I/dvm_gc_info( 94): [7017575181485176104,-9053780441931634733,-4010030953047537782,8554533] I/force_gc( 209): bg I/dvm_gc_info( 209): [7163384747111232651,-9098816781953771608,-4017912252395432053,7919391] I/am_pause_activity( 52): [1128800640,com.android.launcher/.Launcher] I/am_task_to_front( 52): 3 I/am_finish_activity( 52): [1129575992,3,com.cequint.cityid/.About,clear] I/am_destroy_activity( 52): [1129575992,3,com.cequint.cityid/.About] I/am_new_intent( 52): [112951,3,com.cequint.cityid/.UserLaunch,android.intent.action.MAIN,,, 274726912] I/am_on_paused_called( 94): com.android.launcher.Launcher I/am_resume_activity( 52): [1129749080,3,com.cequint.cityid/.UserLaunch] I/am_on_resume_called( 209): com.cequint.cityid.UserLaunch I/dvm_gc_madvise_info( 94): [290816,245760] I/dvm_gc_madvise_info( 209): [352256,241664] I/force_gc( 94): bg - John On Mar 25, 10:16 am, Dianne Hackborn wrote: > You can do "adb logcat -b events" to see the event log which will include a > line the activity manager prints when finishing an activity, with the reason > why it is doing it. > > > > > > On Tue, Mar 24, 2009 at 7:24 PM, jseghers wrote: > > > I am just starting on an Android app and I am puzzled about why my > > Task activity stack is being reset any time the application is > > launched from the Home screen. > > > I used the ADT tools to create the application in Eclipse. > > The main activity is ".UserLaunch" and it starts the activity ".About" > > when the user presses a button. > > If the user then presses HOME and then relaunches the app, .UserLaunch > > is displayed and is the only thing on the stack. > > > .UserLaunch has the launchMode singleTask. .About is standard. > > According to the documentation at > >http://developer.android.com/guide/topics/fundamentals.html#lmodes: > > > "However, a "singleTask" activity may or may not have other > > activities above it in the stack. If it does, it is not in position to > > handle the intent, and the intent is dropped. (Even though the intent > > is dropped, its arrival would have caused the task to come to the > > foreground, where it would remain.) " > > > The Task stack should be brought to the foreground and .About should > > still be displayed. > > > I added Logging to all of the lifecycle events (edited to remove > > timestamps and shorten DEBUG/ and INFO/ to D/ and I/) and you can see > > that when HOME is pressed, .About cycles through onPause and onStop > > (as expected). Then when the app is again launched, .About is > > destroyed and .UserLaunch is restarted > > > D/UserLaunch:(670): onCreate() > > D/UserLaunch:(670): onStart() > > D/UserLaunch:(670): onResume() > > I/ActivityManager(52): Displayed activity > > com.cequint.cityid/.UserLaunch: 4910 ms > > I/ActivityManager(52): Starting activity: Intent { comp= > > {com.cequint.cityid/com.cequint.cityid.About} } > > D/UserLaunch:(670): onPause() > > D/About(670): onCreate() > > D/About(670): onStart() > > D/About(670): onResume() > > I/ActivityManager(52): Displayed activity com.cequint.cityid/.About: > > 1031 ms > > D/UserLaunch:(670): onStop() > > I/ActivityManager(52): Starting activity: Intent > > { action=android.intent.action.MAIN categories= > > {android.intent.category.HOME} flags=0x1020 comp= > > {com.android.launcher/com.android.launcher.Launcher} } > > D/About(670): onPause() > > D/About(670): onStop() > > D/dalvikvm(670): GC freed 413 objects / 34128 bytes in 72ms > > I/ActivityManager(52): Starting activity: Intent > > { action=android.intent.action.MAIN categories= > > {android.intent.category.LAUNCHER} flags=0x1020 comp= > > {com.cequint.cityid/com.cequint.cityid.UserLaunch} } > > D/About(670): onDestroy() > > D/UserLaunch:(670): onRestart() > > D/UserLaunch:(670): onStart() > > D/UserLaunch:(670): onResume() > > > Here is the relevant section of the Manifest: > > > > > > android:launchMode="singleTask" > > > > > > > > > > > > > > > > > > > > Anyone have any ideas why this is always resetting the Activity Stack? > > -- > 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.- Hide quoted text - > > - Show quoted text - --~--~-~--~~~---~--~~ 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, sen
[android-developers] Re: Task activity stack always reset when launched from Home
You can do "adb logcat -b events" to see the event log which will include a line the activity manager prints when finishing an activity, with the reason why it is doing it. On Tue, Mar 24, 2009 at 7:24 PM, jseghers wrote: > > I am just starting on an Android app and I am puzzled about why my > Task activity stack is being reset any time the application is > launched from the Home screen. > > I used the ADT tools to create the application in Eclipse. > The main activity is ".UserLaunch" and it starts the activity ".About" > when the user presses a button. > If the user then presses HOME and then relaunches the app, .UserLaunch > is displayed and is the only thing on the stack. > > .UserLaunch has the launchMode singleTask. .About is standard. > According to the documentation at > http://developer.android.com/guide/topics/fundamentals.html#lmodes: > >"However, a "singleTask" activity may or may not have other > activities above it in the stack. If it does, it is not in position to > handle the intent, and the intent is dropped. (Even though the intent > is dropped, its arrival would have caused the task to come to the > foreground, where it would remain.) " > > The Task stack should be brought to the foreground and .About should > still be displayed. > > I added Logging to all of the lifecycle events (edited to remove > timestamps and shorten DEBUG/ and INFO/ to D/ and I/) and you can see > that when HOME is pressed, .About cycles through onPause and onStop > (as expected). Then when the app is again launched, .About is > destroyed and .UserLaunch is restarted > > D/UserLaunch:(670): onCreate() > D/UserLaunch:(670): onStart() > D/UserLaunch:(670): onResume() > I/ActivityManager(52): Displayed activity > com.cequint.cityid/.UserLaunch: 4910 ms > I/ActivityManager(52): Starting activity: Intent { comp= > {com.cequint.cityid/com.cequint.cityid.About} } > D/UserLaunch:(670): onPause() > D/About(670): onCreate() > D/About(670): onStart() > D/About(670): onResume() > I/ActivityManager(52): Displayed activity com.cequint.cityid/.About: > 1031 ms > D/UserLaunch:(670): onStop() > I/ActivityManager(52): Starting activity: Intent > { action=android.intent.action.MAIN categories= > {android.intent.category.HOME} flags=0x1020 comp= > {com.android.launcher/com.android.launcher.Launcher} } > D/About(670): onPause() > D/About(670): onStop() > D/dalvikvm(670): GC freed 413 objects / 34128 bytes in 72ms > I/ActivityManager(52): Starting activity: Intent > { action=android.intent.action.MAIN categories= > {android.intent.category.LAUNCHER} flags=0x1020 comp= > {com.cequint.cityid/com.cequint.cityid.UserLaunch} } > D/About(670): onDestroy() > D/UserLaunch:(670): onRestart() > D/UserLaunch:(670): onStart() > D/UserLaunch:(670): onResume() > > Here is the relevant section of the Manifest: > > > android:launchMode="singleTask" > > > > > > > > > > > Anyone have any ideas why this is always resetting the Activity Stack? > > > > -- 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 -~--~~~~--~~--~--~---