List of usage examples for android.app ActivityManager getMemoryInfo
public void getMemoryInfo(MemoryInfo outInfo)
From source file:Main.java
private static long getAvailabeMemoryM(final Context cxt) { MemoryInfo mi = new MemoryInfo(); ActivityManager activityManager = (ActivityManager) cxt.getSystemService(Context.ACTIVITY_SERVICE); activityManager.getMemoryInfo(mi); return mi.availMem / 1024 / 1024; }
From source file:Main.java
public static boolean isLowMemory(Context context) { ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo(); ActivityManager activityManager = (ActivityManager) context.getSystemService(context.ACTIVITY_SERVICE); activityManager.getMemoryInfo(memoryInfo); return memoryInfo.lowMemory; }
From source file:Main.java
public static long getAvailableMemory(Context context) { ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo(); ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); activityManager.getMemoryInfo(mi); return mi.availMem; }
From source file:Main.java
public static long getSystemMemoryThreshold(Context context) { ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo(); ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); activityManager.getMemoryInfo(mi); return mi.threshold; }
From source file:Main.java
public static boolean isSystemMemoryLow(Context context) { ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo(); ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); activityManager.getMemoryInfo(mi); return mi.lowMemory; }
From source file:Main.java
public static int getRamFree(Activity mActivity) { ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo(); ActivityManager activityManager = (ActivityManager) mActivity.getSystemService(Activity.ACTIVITY_SERVICE); activityManager.getMemoryInfo(mi); int free = (int) (mi.availMem / 1048576L); return free;/*www . ja v a 2s . c om*/ }
From source file:Main.java
public static int getRamTotalMB(Activity mActivity) { ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo(); ActivityManager activityManager = (ActivityManager) mActivity.getSystemService(Activity.ACTIVITY_SERVICE); activityManager.getMemoryInfo(mi); int total = (int) (mi.totalMem / 1048576L); return total; }
From source file:Main.java
public static int getRamUsing(Activity mActivity) { ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo(); ActivityManager activityManager = (ActivityManager) mActivity.getSystemService(Activity.ACTIVITY_SERVICE); activityManager.getMemoryInfo(mi); float availableMegs = (mi.totalMem - mi.availMem) / 1048576L; return (int) availableMegs; }
From source file:Main.java
public static long getAvailableRamInMegs(Context context) { MemoryInfo mi = new MemoryInfo(); ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); activityManager.getMemoryInfo(mi); long availableMegs = mi.availMem / 1048576L; return availableMegs; }
From source file:Main.java
@TargetApi(Build.VERSION_CODES.JELLY_BEAN) public static long getTotalMemoryJB(Context context) { ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo(); ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); activityManager.getMemoryInfo(mi); return mi.totalMem; }