public boolean loadInBackground(InBitmapProvider bitmapProvider){
  ExifInterface ei=new ExifInterface();
  if (readExif(ei)) {
    Integer ori=ei.getTagIntValue(ExifInterface.TAG_ORIENTATION);
    if (ori != null) {
      mRotation=ExifInterface.getRotationForOrientationValue(ori.shortValue());
    }
  }
  mDecoder=loadBitmapRegionDecoder();
  if (mDecoder == null) {
    mState=State.ERROR_LOADING;
    return false;
  }
 else {
    int width=mDecoder.getWidth();
    int height=mDecoder.getHeight();
    BitmapFactory.Options opts=new BitmapFactory.Options();
    opts.inPreferredConfig=Bitmap.Config.ARGB_8888;
    opts.inPreferQualityOverSpeed=true;
    float scale=(float)MAX_PREVIEW_SIZE / Math.max(width,height);
    opts.inSampleSize=BitmapUtils.computeSampleSizeLarger(scale);
    opts.inJustDecodeBounds=false;
    opts.inMutable=true;
    if (bitmapProvider != null) {
      int expectedPixles=(width / opts.inSampleSize) * (height / opts.inSampleSize);
      Bitmap reusableBitmap=bitmapProvider.forPixelCount(expectedPixles);
      if (reusableBitmap != null) {
        opts.inBitmap=reusableBitmap;
        try {
          mPreview=loadPreviewBitmap(opts);
        }
 catch (        IllegalArgumentException e) {
          Log.d(TAG,"Unable to reuse bitmap",e);
          opts.inBitmap=null;
          mPreview=null;
        }
      }
    }
    if (mPreview == null) {
      mPreview=loadPreviewBitmap(opts);
    }
    if (mPreview == null) {
      mState=State.ERROR_LOADING;
      return false;
    }
    try {
      GLUtils.getInternalFormat(mPreview);
      GLUtils.getType(mPreview);
      mState=State.LOADED;
    }
 catch (    IllegalArgumentException e) {
      Log.d(TAG,"Image cannot be rendered on a GL surface",e);
      mState=State.ERROR_LOADING;
    }
    return mState == State.LOADED;
  }
}

public boolean loadInBackground ( InBitmapProvider bitmapProvider ) { ExifInterface ei = new ExifInterface ( ) ; if ( readExif ( ei ) ) { Integer ori = ei . getTagIntValue ( ExifInterface . TAG_ORIENTATION ) ; if ( ori != null ) { mRotation = ExifInterface . getRotationForOrientationValue ( ori . shortValue ( ) ) ; } } mDecoder = loadBitmapRegionDecoder ( ) ; if ( mDecoder == null ) { mState = State . ERROR_LOADING ; return false ; } else { int width = mDecoder . getWidth ( ) ; int height = mDecoder . getHeight ( ) ; BitmapFactory . Options opts = new BitmapFactory . Options ( ) ; opts . inPreferredConfig = Bitmap . Config . ARGB_8888 ; opts . inPreferQualityOverSpeed = true ; float scale = ( float ) MAX_PREVIEW_SIZE / Math . max ( width , height ) ; opts . inSampleSize = BitmapUtils . computeSampleSizeLarger ( scale ) ; opts . inJustDecodeBounds = false ; opts . inMutable = true ; if ( bitmapProvider != null ) { int expectedPixles = ( width / opts . inSampleSize ) * ( height / opts . inSampleSize ) ; Bitmap reusableBitmap = bitmapProvider . forPixelCount ( expectedPixles ) ; if ( reusableBitmap != null ) { opts . inBitmap = reusableBitmap ; try { mPreview = loadPreviewBitmap ( opts ) ; } catch ( IllegalArgumentException e ) { Log . d ( TAG , "Unable to reuse bitmap" , e ) ; opts . inBitmap = null ; mPreview = null ; } } } if ( mPreview == null ) { mPreview = loadPreviewBitmap ( opts ) ; } if ( mPreview == null ) { mState = State . ERROR_LOADING ; return false ; } try { GLUtils . getInternalFormat ( mPreview ) ; GLUtils . getType ( mPreview ) ; mState = State . LOADED ; } catch ( IllegalArgumentException e ) { Log . d ( TAG , "Image cannot be rendered on a GL surface" , e ) ; mState = State . ERROR_LOADING ; } return mState == State . LOADED ; } }
returns whether loading was successful .
