I am trying to get all running applications, I found this on stackoverflow
ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
List<ActivityManager.RunningAppProcessInfo> runningAppProcessInfo = am.getRunningAppProcesses();
for (int i = 0; i < runningAppProcessInfo.size(); i++) {
AlertDialog.Builder dlgAlert = new AlertDialog.Builder(this);
dlgAlert.setMessage(runningAppProcessInfo.get(i).processName);
dlgAlert.setTitle("App Title");
dlgAlert.setPositiveButton("Ok",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
//dismiss the dialog
}
});
dlgAlert.setCancelable(true);
dlgAlert.create().show();
}
but it only shows me my application (the one I am running) which is not what I want, how can I get all running applications?