public static int getCacheSize ( Context ctx ) { final DisplayMetrics displayMetrics = ctx . getResources ( ) . getDisplayMetrics ( ) ; final int screenWidth = displayMetrics . widthPixels ; final int screenHeight = displayMetrics . heightPixels ; // 4 bytes per pixel final int screenBytes = screenWidth * screenHeight * 4 ; return screenBytes * 3 ; }
Returns a cache size equal to approximately three screens worth of images .