http://my.oschina.net/weiyanen/blog/90693
来个例子
01 | private void displayBriefMemory() { |
02 | final ActivityManager activityManager = (ActivityManager) getSystemService(ACTIVITY_SERVICE); |
03 | |
04 | ActivityManager.MemoryInfo info = new ActivityManager.MemoryInfo(); |
05 | |
06 | activityManager.getMemoryInfo(info); |
07 | |
08 | Log.i(tag, "系统剩余内存:" +(info.availMem >> 10 )+ "k" ); |
09 | |
10 | Log.i(tag, "系统是否处于低内存运行:" +info.lowMemory); |
11 | |
12 | Log.i(tag, "当系统剩余内存低于" +info.threshold+ "时就看成低内存运行" ); |
13 | |
14 | } |