从堆栈历史记录删除活动的Andr​​oid [英] Remove Activities from Stack History in Android

查看:100
本文介绍了从堆栈历史记录删除活动的Andr​​oid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以.. 让我们假设活动的顺序如下

So .. let's Suppose the Following Sequence of Activities

A - > B - >ç - >ð - >电子

A -> B -> C -> D -> E

如果我做的措施1 在EI只是想从堆栈中删除E和去回至D。

if I do The Action1 in E I just want remove E from stack and go Back To D.

在另一方面,如果我做的措施2 在E,我想从堆栈中删除E和D和返回到C

on the Other hand, If I do The Action2 in E, I want to remove E and D from stack and return to C

该怎么做?

上面的顺序是简单的实现消息应用程序,所以A是登录活动和B是配置文件活动和C显示好友请求列表和D显示选择的人C型的个人资料,以及在C中有2个按钮一次批准,第二个是取消requset,现在如果点击其中任何一个就带他到e其中是或否做Opperation,如果不将其返回到选定的人的个人资料中,是的,它应该返回到C

the above sequence is simple implement of messaging App, so A is The Log in Activity and B is The Profile Activity and C show the Friend Request List and D show the Profile of selected person form C, and in C there are 2 button one for approved and the second for cancel requset, now if click any of them it take him to E where Yes or No to do the Opperation, if No it return to profile of Selected person , of yes it should return to C

推荐答案

如果措施1 什么也不做,因为如果用户preSS后退按钮,ê将被删除,你又回到了 D 。如果措施2 ,启动 C 与标志 Intent.FLAG_ACTIVITY_CLEAR_TOP ,在 D 电子将被从堆栈中清除

If Action1 do nothing since if a user press the Back button, E will be removed and you are back to D. If Action2, start C with flag Intent.FLAG_ACTIVITY_CLEAR_TOP, the D and E would be cleared from the stack

这篇关于从堆栈历史记录删除活动的Andr​​oid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆