I got it to work now, but only when I do the following:

1. I run my app in Eclipse using Run > Run History > myApp. The app
opens up with the home activity
2. I hit the Back button. The Android home screen with the app menu is
displayed
3. I start my app from the Android app menu. The app opens up with the
home activity
4. From now on, it will work as expected so when I press Home in a
'secondary' activity and then restart my App again from the Android
app menu it will go back to the  'secondary' activity.

Does this have something to do with the way Eclipse starts the
application? Because if I don't run it from Eclipse it works.


On Aug 25, 6:58 pm, hackbod <[EMAIL PROTECTED]> wrote:
> If you hit back from the new home activity, do you see the previous
> "secondary" activity?
>
> Could you please post more information about what you are doing?
> Please note that this behaves correctly in other places, such as
> ApiDemos, so there must be something different than normal that you
> are doing.
>
> On Aug 25, 1: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 android-developers@googlegroups.com
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