Android学习点点滴滴之获取系统可用内存

Android学习点点滴滴之获取系统可用内存

  ActivityManager中包含的MemoryInfo是存储系统内存信息的封装类,我们可以掉用ActivityManager的getMemoryInfo(MemoryInfo outInfo)方法来获取系统的可用内存大小。

 

 

     
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> ActivityManager _ActivityManager = (ActivityManager) this .getSystemService(Context.ACTIVITY_SERVICE); ActivityManager.MemoryInfo minfo = new ActivityManager.MemoryInfo(); _ActivityManager.getMemoryInfo(minfo); Log.i("tag", String.valueOf(minfo.availMem/(1024*1024))+"MB");

 

 

你可能感兴趣的:(android)