I am using following line of code to get the package name of top running application in Android
ActivityManager am = (ActivityManager) context.getSystemService(Activity.ACTIVITY_SERVICE);
String packageName = am.getRunningTasks(1).get(0).topActivity.getPackageName();
What I want is the label name of top running activity in the stack, like if facebook is running on the top , I should get "facebook" as label name of the application