Code example for ActivityManager

Methods: getMemoryClass

0
         *         given percentage of the application's memory class. 
         */ 
        public static BitmapCache getCache(Context context, float percentage) {
            ActivityManager mgr = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
 
            final int memoryClass = mgr.getMemoryClass();
            final int cacheSize = (int) (1048576 * memoryClass * percentage);
 
            return new BitmapCache(cacheSize);
        } 
 
    } 
 
}