查看程序当前内存信息

private void displayBriefMemory() {
final ActivityManager activityManager = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
ActivityManager.MemoryInfo info = new ActivityManager.MemoryInfo();
activityManager.getMemoryInfo(info);
String tag = "====";
Log.i(tag, "系统剩余内存:" + (info.availMem >> 10) + "k");
Log.i(tag, "系统是否处于低内存运行:" + info.lowMemory);
Log.i(tag, "当系统剩余内存低于" + info.threshold + "时就看成低内存运行");
}

你可能感兴趣的:(内存)