Code example for ActivityManager

Methods: getMemoryClass

0
	private static void getMemoryInfo(Context context) {
		sMaxMemoryMB = (int) (Runtime.getRuntime().maxMemory() / MAX_MEMORY_DIVISOR);
		Log.d(TAG, "mMaxMemoryMB = " + sMaxMemoryMB);
		ActivityManager am = (ActivityManager) context
				.getSystemService(Context.ACTIVITY_SERVICE);
		sMemoryClass = am.getMemoryClass();
		Log.d(TAG, "memoryClass = " + sMemoryClass);
	} 
 
	private static void calcOverallCapability(Context context) {
		DisplayMetrics displaymetrics = context.getResources().getDisplayMetrics();
		Log.d(TAG, "Screen density is = " + displaymetrics.densityDpi);
		if (displaymetrics.densityDpi == DisplayMetrics.DENSITY_MEDIUM)
			calcCapabilityLevel(new MediumDensityMemoryLimits()); 
		else if (displaymetrics.densityDpi == DisplayMetrics.DENSITY_LOW)
			calcCapabilityLevel(new LowDensityMemoryLimits()); 
		else 
			calcCapabilityLevel(new HighDensityMemoryLimits()); 
	} 
 
	private static void calcCapabilityLevel(MemoryLimits memoryLimits) {