如何检查是否一个活动的多个实例是present [英] How to check if multiple instances of an Activity are present

查看:86
本文介绍了如何检查是否一个活动的多个实例是present的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直想教自己的Andr​​oid,以及刚刚得知我已经在我的code创建相同的活动的多个实例。从概念上讲,我知道它的存在,但没有任何工具(如DDMS,例如),我可以使用的的,我已经创建了多个实例?

I've been trying to teach myself Android, and have just learned that I've been creating multiple instances of the same Activity in my code. Conceptually I know it's there, but is there any tool (like DDMS, for example) that I can use to see that I've created multiple instances?

这也将有助于我找到了,如果我的实验意图标志工作或没有。

This would also help me find out if my experiments with Intent flags are working or not.

推荐答案

您可以直观的当前活动堆栈使用以下命令:

You can visualize the current activity stack with the following command:

adb shell dumpsys activity

它会告诉你是这样的:

It will show you something like this:

 Running activities (most recent first):
    TaskRecord{40538e50 #164 A com.xxx}
      Run #3: HistoryRecord{xxxx com.xxx/.activities/xxx}
      Run #2: HistoryRecord{xxx com.xxx/.activities/xxx}
      Run #1: HistoryRecord{xxx com.xxx/.activities/xxx}
    TaskRecord{40a89008 #48 I com.android.htcdialer/.Dialer}
      Run #0: HistoryRecord{409d91d0 com.android.htcdialer/.Dialer}

某些资源:

Android的工具,通过罗曼盖伊的。 (整个谈话是不是亚行,你可以用它做什么,但它是值得花一些时间看,因为他介绍并演示了许多调试工具)。

Android Tools by Romain Guy. (The entire talk isn't about ADB and what you can do with it, but it's worth taking some time watching since he introduces and demonstrates many debugging tools).

这篇关于如何检查是否一个活动的多个实例是present的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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