============问题描述============
小菜一个,请教一下函数提示说 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;