Go back to different Activity in back stack in Android

风格不统一 提交于 2019-12-06 08:09:44

问题


Say I have an activity stack as such: A -> B -> C -> D

I would like to create a new activity "E", and end up with a stack like this: A -> B -> E

Basically, upon hitting the back button in activity D, I need to swap out activity C for activity E, and land on it.

Is this possible? Or should I be structuring the navigation differently somehow? Thanks!


回答1:


so while going from activity C to D finish(); C activity.

At last at backPress method of Activity D call activity E and finish(); Activity D



来源:https://stackoverflow.com/questions/49126438/go-back-to-different-activity-in-back-stack-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!