private Response<Bitmap> doContentParse(){
  if (mContentResolver == null) {
    return Response.error(new ParseError("Content Resolver instance is null"));
  }
  final String requestUrl=getUrl();
  final Uri imageUri=Uri.parse(requestUrl);
  BitmapFactory.Options decodeOptions=new BitmapFactory.Options();
  decodeOptions.inInputShareable=true;
  decodeOptions.inPurgeable=true;
  decodeOptions.inPreferredConfig=mDecodeConfig;
  Bitmap bitmap;
  if (mMaxWidth == 0 && mMaxHeight == 0) {
    bitmap=ImageUtils.decodeStream(mContentResolver,imageUri,decodeOptions);
    addMarker("read-full-size-image-from-resource");
  }
 else {
    decodeOptions.inJustDecodeBounds=true;
    ImageUtils.decodeStream(mContentResolver,imageUri,decodeOptions);
    int actualWidth=decodeOptions.outWidth;
    int actualHeight=decodeOptions.outHeight;
    int desiredWidth=getResizedDimension(mMaxWidth,mMaxHeight,actualWidth,actualHeight,mScaleType);
    int desiredHeight=getResizedDimension(mMaxHeight,mMaxWidth,actualHeight,actualWidth,mScaleType);
    decodeOptions.inJustDecodeBounds=false;
    decodeOptions.inSampleSize=ImageUtils.findBestSampleSize(actualWidth,actualHeight,desiredWidth,desiredHeight);
    Bitmap tempBitmap=ImageUtils.decodeStream(mContentResolver,imageUri,decodeOptions);
    addMarker(String.format("read-from-resource-scaled-times-%d",decodeOptions.inSampleSize));
    if (tempBitmap != null && (tempBitmap.getWidth() > desiredWidth || tempBitmap.getHeight() > desiredHeight)) {
      bitmap=Bitmap.createScaledBitmap(tempBitmap,desiredWidth,desiredHeight,true);
      tempBitmap.recycle();
      addMarker("scaling-read-from-resource-bitmap");
    }
 else {
      bitmap=tempBitmap;
    }
  }
  if (bitmap == null) {
    return Response.error(new ParseError());
  }
 else {
    return Response.success(bitmap,HttpHeaderParser.parseBitmapCacheHeaders(bitmap));
  }
}

private Response < Bitmap > doContentParse ( ) { if ( mContentResolver == null ) { return Response . error ( new ParseError ( "Content Resolver instance is null" ) ) ; } final String requestUrl = getUrl ( ) ; final Uri imageUri = Uri . parse ( requestUrl ) ; BitmapFactory . Options decodeOptions = new BitmapFactory . Options ( ) ; decodeOptions . inInputShareable = true ; decodeOptions . inPurgeable = true ; decodeOptions . inPreferredConfig = mDecodeConfig ; Bitmap bitmap ; if ( mMaxWidth == 0 && mMaxHeight == 0 ) { bitmap = ImageUtils . decodeStream ( mContentResolver , imageUri , decodeOptions ) ; addMarker ( "read-full-size-image-from-resource" ) ; } else { decodeOptions . inJustDecodeBounds = true ; ImageUtils . decodeStream ( mContentResolver , imageUri , decodeOptions ) ; int actualWidth = decodeOptions . outWidth ; int actualHeight = decodeOptions . outHeight ; int desiredWidth = getResizedDimension ( mMaxWidth , mMaxHeight , actualWidth , actualHeight , mScaleType ) ; int desiredHeight = getResizedDimension ( mMaxHeight , mMaxWidth , actualHeight , actualWidth , mScaleType ) ; decodeOptions . inJustDecodeBounds = false ; decodeOptions . inSampleSize = ImageUtils . findBestSampleSize ( actualWidth , actualHeight , desiredWidth , desiredHeight ) ; Bitmap tempBitmap = ImageUtils . decodeStream ( mContentResolver , imageUri , decodeOptions ) ; addMarker ( String . format ( "read-from-resource-scaled-times-%d" , decodeOptions . inSampleSize ) ) ; if ( tempBitmap != null && ( tempBitmap . getWidth ( ) > desiredWidth || tempBitmap . getHeight ( ) > desiredHeight ) ) { bitmap = Bitmap . createScaledBitmap ( tempBitmap , desiredWidth , desiredHeight , true ) ; tempBitmap . recycle ( ) ; addMarker ( "scaling-read-from-resource-bitmap" ) ; } else { bitmap = tempBitmap ; } } if ( bitmap == null ) { return Response . error ( new ParseError ( ) ) ; } else { return Response . success ( bitmap , HttpHeaderParser . parseBitmapCacheHeaders ( bitmap ) ) ; } }
the real guts of parsenetworkresponse . broken out for readability . this version is for reading a bitmap from resource
