I have the same problem but I can solve it temporarily doing a clean
restart:

using Windows XP that is:

1. Closing Eclipse.
2. Clearing the folder   C:\Documents and Settings\username\Local
Settings\Application Data\Android
3. Starting Eclipse and running my App.

(Clearing using just wipe-data does not seem to work)

It will now work great and I get the expected behavior where the app
goes back to activity that you had when you pressed Home. But as soon
a I re-run the app in Eclipse (even without code changes) it will
always go back to the main launch activity after pressing Home. I
won't get the expected behavior again until I do another clean
restart.

I have no unusual settings in my AndroidManifest.xml and because it
fully works after a restart I assume it is an Eclipse/Emulator thing.
Sometimes after the re-run I also get this message in the console:

[2008-08-25 15:02:09 - myApp] Re-installation failed due to different
application signatures.
[2008-08-25 15:02:09 - myApp] You must perform a full uninstall of the
application. WARNING: This will remove the application data!
[2008-08-25 15:02:09 - myApp] Please execute 'adb uninstall
com.mycompany.myApp' in a shell.


On Aug 25, 10:05 am, code_android_festival_way
<[EMAIL PROTECTED]> wrote:
> Some information about my application (simplified):
>
> startActivty (user can choose which kind of kontent he wants to post
> in his blog) -> some activity to input some data (let me call ist
> "content" activity) -> service gets started and does some work
> (posting the blogpost, working with some web apis)
>
> What I actually wanted achieve is that when the user clicks on the
> Home button while he is at the "content" activity and restarts the
> application afterwards he should be brought back to the "content"
> activity.
>
> At the moment the following happens regarding to tasks:
>
> Starting the app:  The first activty (MAIN) has Task ID 7
> Starting another activity from my MAIN screen:  The started activity
> has Task ID 7
> Clicking the HOME button and restarting my application: MAIN activity
> gets started with Task ID 7
>
> So the application remains in the same task but doesn't get back to
> the last opened activity before leaving the app to the home screen. I
> have never set any flags like the two you mentioned above.
>
> Do I have to control that by myself (monitoring where I am in the
> chain of activities that the user starts and restart the activity in
> my initial screen) or is there some flag? I can't find that out from
> the app model document.
>
> Regards!
>
> On 25 Aug., 09:16, hackbod <[EMAIL PROTECTED]> wrote:
>
>
>
> > What are you actually trying to do?  I doubt this parameter is what
> > you want -- it is used to defeat the default behavior of resetting an
> > application's task state after the device has been asleep for a
> > certain amount of time.  That is, it will have -no- impact on the
> > behavior of your application unless you put the emulator to sleep for
> > that amount of time (I believe 30 minutes) and then launch it from
> > home.
>
> > If you are -always- returning back the initial screen of your app when
> > returning from home, that indicates some other problem in how you have
> > structure your app.  This might be useful information to help
> > understand what is going 
> > on:http://code.google.com/android/intro/appmodel.html
>
> > Some common things to watch out for:
>
> > - Don't use android:singleTask (unless you understand what that is and
> > really actually do want everything it implies).
> > - Don't use Intent.FLAG_ACTIVITY_NEW_TASK (unless you understand what
> > that is and really actually do want everything it implies).
>
> > The above referenced doc has information on these as well.
>
> > On Aug 22, 6:05 am, code_android_festival_way
>
> > <[EMAIL PROTECTED]> wrote:
> > > I came across the parameter "alwaysRetainTaskState" 
> > > athttp://code.google.com/android/reference/android/R.attr.html#alwaysRe...
> > > and don't really know how to use it the right way. I've got several
> > > activities in my application and want to persist the state of my
> > > activity UI so that the user can press the home button and after
> > > starting my application again he will come back to the last opened
> > > activity.
> > > When I understand the parameter in the right way I think that he
> > > should do what I want. Now I've added the parameter to all activities
> > > in my AndroidManifest but after restarting my application from the
> > > home screen (after pressing the home button in my app) I'm always
> > > getting back to my initial screen.
>
> > > Here is one sample from my AndroidManifest:
>
> > >         <activity android:name=".Preferences"
> > >                           android:alwaysRetainTaskState="true">
> > >         </activity>
>
> > > What am I doing wrong? In addition I'd like to ask what state in
> > > detail will be presisted. (the complete UI state?)
>
> > > Regards!- 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 [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to