Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

print the current back stack in the log

Is there a way to print the current back stack of the current task in an Android app? In particular, I want to understand when an activity is popped off the stack after its onDestroy() is called.

like image 868
dacongy Avatar asked Jul 18 '12 20:07

dacongy


2 Answers

To improve on Paul's answer and see data relevant to your app only you can do:

adb shell dumpsys activity package <your.package.name>
like image 126
sham Avatar answered Oct 31 '22 06:10

sham


Use the command below can show tasks and activity backstack

adb shell dumpsys activity activities | sed -En -e '/Running activities/,/Run #0/p'

And result looks like this:

Running activities (most recent first):
  TaskRecord{29b17859 #1134 A=com.google.android.dialer U=0 sz=1}
    Run #0: ActivityRecord{180fd6be u0 com.google.android.dialer/.extensions.GoogleDialtactsActivity t1134}
Running activities (most recent first):
  TaskRecord{7764a61 #1054 A=com.google.android.googlequicksearchbox U=0 sz=1}
    Run #1: ActivityRecord{2900994b u0 com.google.android.googlequicksearchbox/com.google.android.launcher.GEL t1054}
  TaskRecord{4aa804c #1129 A=com.android.systemui U=0 sz=1}
    Run #0: ActivityRecord{1816140b u0 com.android.systemui/.recents.RecentsActivity t1129}
like image 39
Euporie Avatar answered Oct 31 '22 06:10

Euporie