Android 如何检索设备上可用的最大堆?
我有个问题。我的应用程序使用20MB内存,所以我想避免使用内存堆小于20MB的手机。 我尝试了Runtime.getRuntime.maxMemory(),但是这个函数检索到了错误的结果(SGS3上为256MB),因为我想检索单个应用程序的可用堆 我怎样才能发现它? 清单中是否有属性Android 如何检索设备上可用的最大堆?,android,heap,android-manifest,Android,Heap,Android Manifest,我有个问题。我的应用程序使用20MB内存,所以我想避免使用内存堆小于20MB的手机。 我尝试了Runtime.getRuntime.maxMemory(),但是这个函数检索到了错误的结果(SGS3上为256MB),因为我想检索单个应用程序的可用堆 我怎样才能发现它? 清单中是否有属性 谢谢。您需要的是getMemoryClass ((ActivityManager) getSystemService(Context.ACTIVITY_SERVICE)).getMemoryClass(); 它
谢谢。您需要的是
getMemoryClass
((ActivityManager) getSystemService(Context.ACTIVITY_SERVICE)).getMemoryClass();
它返回当前设备的每个应用程序内存类的近似值。您需要的是
getMemoryClass
((ActivityManager) getSystemService(Context.ACTIVITY_SERVICE)).getMemoryClass();
它返回当前设备的每个应用程序内存类的近似值