开发者

How to manipulate Activity back stack? [duplicate]

This question already has an answer here: 开发者_如何学JAVA How to kill sub activities and bring activity to top of stack (1 answer) Closed 3 years ago.

I want to implement the following logic. I have 4 activites A, B, C and D.

The flow is A -> B -> C -> D

When the user navigates from A -> C he should be able to get back to the previous activities by pressing the back button. But after reaching D pressing the back button should take him to activity A. And pressing the back button againg should exit the application instead of taking him back to B / C / D. How do I do it.


I don't know if you actually can manipulate the stack of application like your suggesting in your title.

My app runs in opengl so I never actually change form one Activity to another but I think the following principle will also work:

Why don't you call the Activity you want yourself ?

it is really straight forwards in the back button event to handle this.

on back pressed -> load activity you want

if your in activity A then exit

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜