[英]Move to parent activity without finishing child activity using back button
Is it possible to go one activity back without finishing the one you're leaving? 是否可以在不完成要离开的活动的情况下返回一项活动? In my android app, I have a drawer activity, which with a drawer item click opens a new activity.
在我的android应用中,我有一个抽屉活动,通过单击抽屉项目可以打开一个新活动。 However, when I try to move back to the drawer activity using the back button, the newly opened activity is destroyed.
但是,当我尝试使用“后退”按钮移回到抽屉活动时,新打开的活动将被破坏。 Is it possible to move that activity back so it runs in background?
是否可以将该活动移回后台运行?
Move from drawer activity to next activity by setting the flag to clear the stack and now stack only has one activity which need to run in background now open drawer activity. 通过设置标志以清除堆栈,从抽屉活动移至下一个活动,现在堆栈只有一个活动需要在后台运行,现在打开抽屉活动。
ie 即
A => drawer activity A =>抽屉活动
B => activity which need to run in background B =>需要在后台运行的活动
Step-1 第1步
open A 打开A
now stack has only A 现在堆栈只有一个
Step-2 第2步
move from A -> B by clearing the flag 通过清除标志从A-> B移动
now stack has only B 现在堆栈只有B
Step-3 第三步
move from B -> A 从B-> A移
now stack has only B and A. A is on top of stack and B is still in stack 现在堆栈只有B和A。A在堆栈顶部,B仍在堆栈中
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.