// 获得设备内存信息
public static Object[] getMemInfo(Context mContext) {
float availMem;
float totalMem;
boolean lowMem;
// 得到ActivityManager
ActivityManager am = SystemManagerUtils.getActivityManager(mContext);
// 创建ActivityManager.MemoryInfo对象
ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
am.getMemoryInfo(mi);
// 取得剩余的内存空间
availMem = mi.availMem / 1024 / 1024 / 1024f;
totalMem = mi.totalMem / 1024 / 1024 / 1024f;
lowMem = mi.lowMemory;
System.out.println("设备总内存:" + String.format("%.2f", totalMem) + "G");
System.out.println("设备可用内存:" + String.format("%.2f", availMem) + "G");
System.out.println("是否低内存状态:" + mi.lowMemory);
return new Object[]{totalMem, availMem, lowMem};
}
//打印设备/App内存信息
public static void printMemore(Context ctx){
floa