2

I am looking for a tool (perhaps an Eclipse plugin) that can give me some visibility into Android's back stack. I am trying to find my way around an application that I inherited. I frequently navigate to a screen, then try to determine what activity is running. I have the source code, so I can always answer this question, but it is not always quick and easy.

It would be great if in DDMS I could see an indication of what activity is active. It would be even better if I could view the entire contents of the back stack, or at least those activies in my process. That would give me some nice visibility into what Android is doing.

I realize that there are permission issues that would/should prevent this on an actual device, but I would be fine if this simply worked with the emulator.

Does anyone know of a tool or an approach that could help with this?

TNR
  • 5,839
  • 3
  • 33
  • 62
EJK
  • 12,332
  • 3
  • 38
  • 55
  • Read the [developers SDK on the lifecycle of the activities](http://developer.android.com/training/basics/activity-lifecycle/index.html), then, use the source luke, read it, breathe it, study it, modify it by sprinkling **Log.d(TAG, "HERE")** in the lifecycle of activities functions, that's how you'll get to know where you are! – t0mm13b Jan 15 '13 at 15:37
  • 1
    Thanks for the comment. I am quite familiar with activity lifecycle and have already put the Log statements in, which did help. I was however hoping for a more general, less intrusive approach that potentially gave me visibility beyond my app. – EJK Jan 15 '13 at 15:40
  • 1
    adb is your friend: http://stackoverflow.com/questions/2442713/view-the-tasks-activity-stack – Charlie Collins Jan 15 '13 at 18:32

1 Answers1

0

There is a similar question like this and became quite popular.

Learning from that question, you can use this command in the adb shell :dumpsys activity. This will dump the current state of the activity manager. By digging into it, you can get the list of tasks and activities that are in the back-stack. According to techterms, it is not advisable for any programmer to get the pieces in the middle of the stack(which breaks the purpose of stack). So there will not a any direct way you can get the full view of the backstack.

Mainly dumpsys activity dumps what happened since the start of the activity manager. So it all starts with an empty back-stack and fills up later. So you can see what is pushed and what is popped from the stack to get the state of current stack.

Rahat Zaman
  • 1,322
  • 14
  • 32