开发者

How to avoid history of activity

开发者 https://www.devze.com 2023-01-20 12:08 出处:网络
I have total 3 activities. First activity(A) starts second activity(B). From Activity B, 3rd activity(C) is called.

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 eve开发者_StackOverflow中文版r called?

Thanks in advance,

JRC


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

0

精彩评论

暂无评论...
验证码 换一张
取 消