views:

16

answers:

0

There are two Activities in my application: LoginActivity and RegisterActivity. The launch mode of LoginActivity is setted to singleInstance in manifest xml. RegisterActivity use the default launch mode. Following are what I did:

The italic part is what I think might happen.

  1. Launch the app, LoginActivity shows. An task is created, just call it TaskA.
  2. Press "Register" button in LoginActivity, RegisterActivity shows. An new task is created, we can call it TaskB.
  3. Press BACK hard key, exit RegisterActivity, LoginActivity comes to front. TaskB is destoryed
  4. Press BACK hard key again, exit the application. LoginActivity is the top Acivitiy in last task(TaskA) of the application.
  5. Launch the application from history(Long press HOME key). LoginActivity should be shown

Expected Result: LoginActivity is shown.
Actual Result: RegisterActivity is shown.

What I want to ask is how Android decide which Activity will be started when user launches app from history?