Menu Home

memory

Android:获取内存和进程信息

ActivityManager mAm = (ActivityManager)context.getSystemService(Context.ACTIVITY_SERVICE); private int getAppsRunning() { List<RunningAppProcessInfo> runningApps = mAm.getRunningAppProcesses(); return runningApps.size(); } private long getFreeMemory() { MemoryInfo mi = new MemoryInfo(); mAm.getMemoryInfo(mi); return mi.availMem; }