question: public static Bitmap decodeResourceWithBackouts ( Resources res , BitmapFactory . Options options , int id ) { boolean noBitmap = true ; int num_tries = 0 ; if ( options . inSampleSize < 1 ) { options . inSampleSize = 1 ; } Bitmap bmap = null ; while ( noBitmap ) { try { bmap = BitmapFactory . decodeResource ( res , id , options ) ; noBitmap = false ; } catch ( java . lang . OutOfMemoryError e ) { if ( ++ num_tries >= BITMAP_LOAD_BACKOUT_ATTEMPTS ) { throw e ; } bmap = null ; System . gc ( ) ; options . inSampleSize *= 2 ; } } return bmap ; }
target:  Loads bitmap from a resource that may be downsampled in low-memory situations.