6

I can run an application in background but I want to know how many applications are running in the background. Like in some mobile while pressing the center button a list of currently running applications are displayed.

Is this is possible in android? If possible then give some code snippets and steps to achieve this.

Shahzad Barkati
  • 2,532
  • 6
  • 25
  • 33
Rajapandian
  • 7,059
  • 11
  • 37
  • 27

1 Answers1

5

The Dev Tools application (installed in emulators) shows a list of running processes by obtaining an instance of ActivityManager:

ActivityManager am = (ActivityManager)getSystemService(Context.ACTIVITY_SERVICE);
List<ActivityManager.RunningAppProcessInfo> l = am.getRunningAppProcesses();
Josef Pfleger
  • 74,165
  • 16
  • 97
  • 99