public static Bitmap loadBitmapWithBackouts(Context context,Uri sourceUri,int sampleSize){
  boolean noBitmap=true;
  int num_tries=0;
  if (sampleSize <= 0) {
    sampleSize=1;
  }
  Bitmap bmap=null;
  while (noBitmap) {
    try {
      bmap=loadDownsampledBitmap(context,sourceUri,sampleSize);
      noBitmap=false;
    }
 catch (    java.lang.OutOfMemoryError e) {
      if (++num_tries >= BITMAP_LOAD_BACKOUT_ATTEMPTS) {
        throw e;
      }
      bmap=null;
      System.gc();
      sampleSize*=2;
    }
  }
  return bmap;
}

public static Bitmap loadBitmapWithBackouts ( Context context , Uri sourceUri , int sampleSize ) { boolean noBitmap = true ; int num_tries = 0 ; if ( sampleSize <= 0 ) { sampleSize = 1 ; } Bitmap bmap = null ; while ( noBitmap ) { try { bmap = loadDownsampledBitmap ( context , sourceUri , sampleSize ) ; noBitmap = false ; } catch ( java . lang . OutOfMemoryError e ) { if ( ++ num_tries >= BITMAP_LOAD_BACKOUT_ATTEMPTS ) { throw e ; } bmap = null ; System . gc ( ) ; sampleSize *= 2 ; } } return bmap ; }
loads a bitmap that is downsampled by at least the input sample size . in low - memory situations , the bitmap may be downsampled further .
