安卓:编程方式访问活动栈 [英] Android: access the Activity stack programmatically

查看:111
本文介绍了安卓:编程方式访问活动栈的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是不可能性,以获得$ ​​C $ c把当前活动栈?

is it possibile to get the current Activity stack from code?

下面是我的使用情况:

  • 用户从活动导航到活动

A - > B - >ç - >ð - > ...

A -> B -> c -> D -> ...

  • 一些活动的发送用户新的屏幕后会完成,有些则不会

  • some of the Activity will finish after sending the user to the new screen, some others won't

我需要检查是否pressing BACK按钮将使用户的活性或任何其他因为在当前显示的活动我有一个按钮,完成活动和按钮的图标不同的天气,你会被带到塔活动A或其它活动。

I need to check if pressing the BACK button will bring the user to the Activity A or any other because in the currently shown Activity I have a button that finishes the Activity and the icon of the button is different weather you'll be taken to tha Activity A or another Activity.

在此先感谢,

再见, 毛里齐奥

推荐答案

我的IM pression是答案的文字问题是不 - 你无法访问。但是,有可能是另一种方式来完成你所需要的。

My impression is that the answer to the literal question is "no" - you cannot access that. But there's probably another way to accomplish what you need.

如果这些都是你的活动,为什么不把一个额外的意图(前进方向去的时候),这表示该活动是从未来。

If these are all your activities, why not put an extra in the Intent (when going in the forward direction) which says which activity it is coming from.

您可以决定哪些后退按钮图像显示的基础上检查额外的,它会告诉你什么是previous活性(如果它是你一 - 如果它是空的,你必须假定它来自什么地方中的其他系统)

You can then decide which back button image to display based on checking that extra, which should tell you what the previous activity was (if it was one of yours - if it's empty you have to assume it came from somewhere else in the system)

这篇关于安卓:编程方式访问活动栈的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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