print the current back stack in the log

android, back-stack, user-interface

Solution

You can use adb for this:

adb shell dumpsys activity

Problem

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.

Original source