Showing posts from November, 2017

How to get the list of Activities from BackStack

Two ways are there,

1. Using ADB Commands

Here is the complete list to get activities, services & processes 1. adb shell dumpsys activity activities -> displays list of activities in back stack 2. adb shell dumpsys activity process -> displays list process in back stack 3. adb shell dumpsys activity services -> displays list of services running in back stack
Another alternate way is through ActivityManager,
ActivityManager m = (ActivityManager) ctx.getSystemService( ctx.ACTIVITY_SERVICE ); List runningTaskInfoList = m.getRunningTasks(10); Iterator itr = runningTaskInfoList.iterator(); while(itr.hasNext()){ RunningTaskInfo runningTaskInfo = (RunningTaskInfo); int id =; CharSequence desc= runningTaskInfo.description; int numOfActivities = runningTaskInfo.numActivities; String topActivity = runningTaskInfo.topActivity.getShortClassName(); }