码迷,mamicode.com
首页 > 其他好文 > 详细

ActivityManager.MemoryInfo 小问题

时间:2014-11-08 13:36:31      阅读:167      评论:0      收藏:0      [点我收藏+]

标签:java   sp   on   问题   cti   bs   new   as   tt   

============问题描述============


小菜一个,请教一下函数提示说 totalMem 
totalMem cannot be resolved or is not a field
可能怀疑我用的sdk是旧的,我在google 文档看到的这个成员函数是在sdk18版本上看的

    public long getTotalAvaile()

    {

    	long memTotal;

    	ActivityManager am=(ActivityManager)getSystemService(Context.ACTIVITY_SERVICE);

    	ActivityManager.MemoryInfo mi=new ActivityManager.MemoryInfo();

    	//MemoryInfo

    	am.getMemoryInfo(mi);

    	memTotal=mi.totalMem();

    	

    	return memTotal;

    }

============解决方案1============


totalMem是个域,不是方法,改成这样:
memTotal=mi.totalMem;

ActivityManager.MemoryInfo 小问题

标签:java   sp   on   问题   cti   bs   new   as   tt   

原文地址:http://www.cnblogs.com/meizhenfen42/p/4083085.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!