Code example for ActivityManager

Methods: getRunningAppProcesses

0
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
 
		// Get running processes 
		ActivityManager manager = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
		List<RunningAppProcessInfo> runningProcesses = manager.getRunningAppProcesses();
		if (runningProcesses != null && runningProcesses.size() > 0) {
			// Set data to the list adapter 
			setListAdapter(new ListAdapter(this, runningProcesses));
		} else { 
			// In case there are no processes running (not a chance :)) 
			Toast.makeText(getApplicationContext(), "No application is running", Toast.LENGTH_LONG).show();
		} 
 
	} 
	 
	@Override 
	protected void onListItemClick(ListView l, View v, int position, long id) {
		long send 		= 0;
		long recived 	= 0;
		// Get UID of the selected process