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 <jsegh...@cequint.com> 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=0x10200000 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=0x10200000 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: > > <application android:icon="@drawable/icon" android:label="@string/ > app_name"> > <activity android:name=".UserLaunch" android:label="@string/app_name" > android:launchMode="singleTask" > > <intent-filter> > <action android:name="android.intent.action.MAIN" /> > <category android:name="android.intent.category.LAUNCHER" /> > </intent-filter> > </activity> > <activity android:name=".About" android:launchMode="standard"> > </activity> > </application> > > 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 -~----------~----~----~----~------~----~------~--~---