/**
* 获取全部内存
*
* @param context
* @return
*/
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public static long getTotalMemoryInfo(Context context) {
// 获取活动管理器
ActivityManager am = (ActivityManager) context
.getSystemService(Context.ACTIVITY_SERVICE);
MemoryInfo outInfo = new MemoryInfo();
// 参1 内存信息
am.getMemoryInfo(outInfo);
long totalMem = 0;
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN) {
// 判断版本号 如果大于16
totalMem = outInfo.totalMem;
} else {
// 低版本获取全部内存
totalMem = getTotalMemoryInfoInLow();
}
return totalMem;// 全部内存
}