get Running Process Number - Android Android OS

Android examples for Android OS:Process

Description

get Running Process Number

Demo Code


//package com.java2s;

import java.util.List;
import android.app.ActivityManager;

import android.app.ActivityManager.RunningAppProcessInfo;

import android.content.Context;

public class Main {

    public static int getRunningProcessNumber(Context context) {
        ActivityManager am = (ActivityManager) context
                .getSystemService(context.ACTIVITY_SERVICE);
        List<RunningAppProcessInfo> runningAppProcesses = am
                .getRunningAppProcesses();
        return runningAppProcesses.size();
    }//w  w w  .j av  a 2  s . c o m
}

Related Tutorials