public boolean isLowMemory()
{
int usedSize = 0;
try
{
Runtime runtime = Runtime.getRuntime();
final float usedMemInMB = (runtime.totalMemory() - runtime.freeMemory()) / 1048576L;
final float maxHeapSizeInMB = runtime.maxMemory() / 1048576L;
usedSize = (int) ((usedMemInMB / maxHeapSizeInMB) * 100);
}
catch (Exception e)
{
e.printStackTrace();
}
if (usedSize >= 80) { return true; }
else { return false; }
}
格式化
廣告
文章分類
廣告2
2015年9月1日 星期二
android 程式取得剩餘/使用記憶體百分比
訂閱:
張貼留言
(
Atom
)

沒有留言 :
張貼留言