views:

30

answers:

1

Hello,

I have 2 activities declared as singleTask in my application. The reason for this is, with standard mode, pressing "HOME" in one activity (say A) and launching another (say B), still shows activity A.

However, a new problem arises because of this.

A -> "HOME" -> B (Result : B, Expected Result: B) -> "BACK" -> (Result:A, Expected Result: Home Screen)

Any ideas why?

A: 

One thing that doesn't make sense:

pressing "HOME" in one activity (say A) and launching another (say B), still shows activity A.

However, a new problem arises because of this.

A -> "HOME" -> B (Result : B, Expected Result: B)

If pressing home in A and launching B still shows A is your goal with two singleTasks, then how can A -> HOME -> B have an expected result B for you?


Now I'll try and be helpful: Which Activity, A or B, handles the Launcher intent?

A -> HOME -> B (Result: B) would make me guess that B is that Activity that does, and if that is the case, your being at A before pressing HOME would mean that your stack would be something like A above B (A displayed), so pressing Home and launching B would make your stack B above A (B displayed).

Then if A and B are in a stack, pressing BACK will move you down from B to A (A now being displayed). This sounds like your problem.

If you want to take them to the home screen instead of moving down the stack, you will need to override the standard back button handler of the system, and whenever you need to override a system mechanic, it means you should double check what your doing is really the right way to achieve your goal.

If you post more information I will update my answer to help you sort this out.

Guzba