This is the way to get all the running activities in the application -
try {
ActivityInfo[] list = getPackageManager().getPackageInfo(getPackageName(),PackageManager.GET_ACTIVITIES).activities;
for(int i = 0;i< list.length;i++)
{
System.out.println("List of running activities"+list[i].name);
}
}
catch (NameNotFoundException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}