views:

83

answers:

1

Hi,

In my application, I have problem with activity history stack. Indeed, consider I have 5 activities :

  1. Splashscreen
  2. SignUp
  3. SignIn
  4. ForgottenPassword
  5. Home

I would see :

  • First launch (user not logged) : 3 differents wireframes possible
    • Splashscreen -> SignUp -> Home
    • Splashscreen -> SignUp (already member) -> SignIn (valid log) -> Home
    • Splashscreen -> SignUp (already member) -> SignIn -> ForgottenPassword (login/password receive by mail)-> SignIn (valid log) -> Home
  • Other launch (user registered) : Splashscreen -> Home (auto log)

The problem is : I would like 2 tasks, one with Splashscreen, SignUp, SignIn and ForgottenPassword and an other with Splashscreen and Home. Why ? Because back from Home should close the application but go back to previous activity (SignUp or SignIn according wireframe). Define activity with history=true on SignUp and SignIn do that but does not allow ForgottenPassword -> SignIn and SignIn -> SignUp :(

Thanks for your help

A: 

There a couple of ways to do this, one way:

Whenever you start the Home activity, use startActivityForResult. When the home activity exits (user hits back), the previous activity will be notified. If you don't want that activity to be shown, immediately finish that activity. You can use the request or result codes to help you determine if you want to show the activity again.

I belive you can also do something like this:

startActivity(homeActivityIntent);
finish();

to remove the previous activity from the stack when you start the home activity.

Mayra