> The user enters the username
> and password and if it is correct I call finish() on Activity A an
> call startActivity to start Activty B.

You are calling startActivity from onPause() then? If you are calling
startActivity and then finish(), finish() won't actually execute until
the new activity you started finishes. At the moment you call
startActivity on B, A's onPause will be called and B will start
executing.

> I thought
> to my self: If I know that the user is logged in I can call finish()
> in the onCreate() of Activty A.

>From the rest of your description I'm also not clear if your code is
the same when you started your question as it is when you finish it.
Do your comments after this point in your post relate to code that is
different.

> The problem now is that if I hit Back from Activity B and then click
> the home screen app icon of course nothing happens because Activity A
> calls finish().

What do you mean "nothing happens"? Something has to happen, something
will be launch, even it it closes immediately. If you were in B and
you press 'back' and see the home screen, then an instance of A no
longer exists, because it would be behind B. My guess is what is
actually happening is that when you hit 'back' from B, A is
immediately finishing. When you try to launch your application from
the home screen again, I'm not sure what is happening.

Hopefully you can clarify exactly what you're doing.

Cheers,
Justin
Android Team @ Google

On Aug 21, 12:38 pm, Gil <[EMAIL PROTECTED]> wrote:
> I did more research on this subject and I have a new situation.
> Activity A is the main activity and it uses the singleTask launch
> mode. Activity B uses the singleTop launch mode. In my app Activity A
> is the login activity for my application. The user enters the username
> and password and if it is correct I call finish() on Activity A an
> call startActivity to start Activty B.
>
> If I hit the Home button while in the Activity B and then hit the home
> screen icon of the app something interesting happens: Activity A comes
> to the front. If I hit the Back button I now see Activity B. I thought
> to my self: If I know that the user is logged in I can call finish()
> in the onCreate() of Activty A.That works, meaning that while I'm in
> Activity B I hit the Home button, clicking the home screen app icon
> returns me to Activity B without displaying Activty A; so far so good.
> The problem now is that if I hit Back from Activity B and then click
> the home screen app icon of course nothing happens because Activity A
> calls finish().
>
> Please let me know if I'm on the right path. Thanks!
--~--~---------~--~----~------------~-------~--~----~
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