Question

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

Was it helpful?

Solution

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

Other possibilities are mentioned here: Removing an activity from the history stack

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top