如何检查是否一个活动的多个实例是present
我一直想教自己的Android,以及刚刚得知我已经在我的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).