views:

39

answers:

1

Hello All,

I have total 3 activities. First activity(A) starts second activity(B). From Activity B, 3rd activity(C) is called.

Activity B, shows list with checkbox to select items and single OK button. On clicking OK button Activity C is called with selection.

When user clicks BACK button in Activity C, by default Activity B is displayed (with selected checkbox).

I want to display Activity A when BACK button is clicked in Activity C.

How to achieve that?

I have handled OnKeyDown() in Activity C to startactivity(A). it is working. But when user clicks BACK button on Activity A, again Activity C is displayed. while application should end.

In this direction how to skip Activity B is ever called?

Thanks in advance,

JRC

+3  A: 

Don't do onKeyDown - that's a terrible hack. Instead, simply call finish() before starting activity C.

Other possibilities are mentioned here: http://stackoverflow.com/questions/1898886/removing-an-activity-from-the-history-stack

EboMike
Thanks a lot. It did serve my task.
JRC