开发者

Figure out what Activity is currently active in Android (non-programmatically)

A lot of time when I'm debugging my app, I click around and end up in an activity, but I'm not 100% sure which one. This happens in my latest project, which I inherited from someone else.

I want an easy method of figuring out which activity I'm currently in, not programmatically for the program to know, but for my brain. I see Ac开发者_JAVA百科tivityManager does say something like "Displayed activity foo" in logcat, but sometimes this message quickly goes away because of other logging.

Ideally, the current activity class would be displayed somewhere at all times, or there would be something similar to Firebug's Inspect button but for activities. I looked around the DDMS perspective and didn't find it there either.

Any ideas?


The hierarchyviewer is fine for this, but perhaps a bit heavy duty.

Try this from command line:

adb logcat |grep "Starting activity"

Every time you start a new activity there will a line printed.


I'm not sure if I've understood you, but there's a tool called hierarchy-viewer to debug the user interface


You can also add this to the watch expressions.


Filtering the logcat on ActivityManager is the most easy way to figure this out.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜