如何获得活动历史堆栈的名单? [英] How to get a list of the activity history stack?

查看:100
本文介绍了如何获得活动历史堆栈的名单?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我挣扎,在我的应用程序的问题。我想提供一种方法来列出previous拉开活动的历史。

我觉得有两种可能的解决方案,但我不知道要找到一个稳定的方式来实现其中任何一个。

  • 在某种方式使用功能的SDK。我尝试使用getPackageManager()和getActivityManager(),但我找不到任何合适的解决方案
  • 在实现自己的历史,但后来我不得不重写startActivity,我真的不希望走这条道路作为一项活动可以在其他多种方式启动。

那么,有没有办法做到这一点使用功能的SDK?

非常感谢。

编辑:

我有另外一个想法,这是一个有点不同。有没有可能听开始/结束的活动与某种接收到特定的应用程序(我的)事件和跟踪栈的历史?

解决方案
  

那么,有没有办法做到这一点使用功能的SDK?

没有,不好意思。

  

有没有可能听开始/结束的活动与某种接收到特定的应用程序(我的)事件和跟踪栈的历史?

您可以使用 registerActivityLifecycleCallbacks()应用程序,如果你只打算支持API级别14或更高(又名,安卓4.0 +)。

I'm struggling with an issue in my app. I'd like to provide a way to list the history of the previous opened activities.

I think there are two potential solutions but I'm not sure to find a stable way to achieve any of them.

  • Somehow use a function from the SDK. I tried using getPackageManager() and getActivityManager() but I can't find any suitable solution
  • Implement my own history but then I'll have to override startActivity and I don't really want to go down that way as an activity can be started in other multiple ways.

So is there a way to do that using a function from the SDK?

Many thanks.

EDIT:

I've got another idea, it's a bit different. Would it be possible to listen to "start/finish activity" events with some kind of receiver to a specific app (mine) and keep track of the stack history?

解决方案

So is there a way to do that using a function from the SDK?

No, sorry.

Would it be possible to listen to "start/finish activity" events with some kind of receiver to a specific app (mine) and keep track of the stack history?

You can use registerActivityLifecycleCallbacks() on Application, if you are only going to support API Level 14 and higher (a.k.a., Android 4.0+).

这篇关于如何获得活动历史堆栈的名单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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