public Bitmap synchronouslyLoadBitmap(Resources resources) {
        if (bitmap != null) {
            if (decoderOptions != null && decoderOptions.inSampleSize > 1) {
                return Bitmap.createScaledBitmap(bitmap, bitmap.getWidth() / decoderOptions.inSampleSize, bitmap.getHeight() / decoderOptions.inSampleSize, false);
            } else {
                return bitmap;
            }
        } else if (resId != null) {
            return BitmapFactory.decodeResource(resources, resId, decoderOptions);
        } else if (fileToBitmap != null) {
            return BitmapFactory.decodeFile(fileToBitmap.getAbsolutePath(), decoderOptions);
        } else if (inputStream != null) {
            return BitmapFactory.decodeStream(inputStream, null, decoderOptions);
        } else if (view != null) {
            int downSample = 1;
            Bitmap.Config config = Bitmap.Config.ARGB_8888;
            if (decoderOptions != null) {
                if (decoderOptions.inSampleSize > 1) {
                    downSample = decoderOptions.inSampleSize;
                }
                if (decoderOptions.inPreferredConfig != null) {
                    config = decoderOptions.inPreferredConfig;
                }
            }
            return BuilderUtil.drawViewToBitmap(bitmap, view, downSample, config);
        }
        throw new IllegalStateException("No image resource was set");
    }
public Bitmap synchronouslyLoadBitmap ( Resources resources ) { if ( bitmap != null ) { if ( decoderOptions != null && decoderOptions . inSampleSize > 1 ) { return Bitmap . createScaledBitmap ( bitmap , bitmap . getWidth ( ) / decoderOptions . inSampleSize , bitmap . getHeight ( ) / decoderOptions . inSampleSize , false ) ; } else { return bitmap ; } } else if ( resId != null ) { return BitmapFactory . decodeResource ( resources , resId , decoderOptions ) ; } else if ( fileToBitmap != null ) { return BitmapFactory . decodeFile ( fileToBitmap . getAbsolutePath ( ) , decoderOptions ) ; } else if ( inputStream != null ) { return BitmapFactory . decodeStream ( inputStream , null , decoderOptions ) ; } else if ( view != null ) { int downSample = 1 ; Bitmap . Config config = Bitmap . Config . ARGB_8888 ; if ( decoderOptions != null ) { if ( decoderOptions . inSampleSize > 1 ) { downSample = decoderOptions . inSampleSize ; } if ( decoderOptions . inPreferredConfig != null ) { config = decoderOptions . inPreferredConfig ; } } return BuilderUtil . drawViewToBitmap ( bitmap , view , downSample , config ) ; } throw new IllegalStateException ( "No image resource was set" ) ; }
This will synchronously load the bitmap (if needed) maybe don't
call this in the main thread. Loading of large bitmaps can take up
500 ms+ on faster devices.

@param resources {@link android.content.Context#getResources()}
@return the loaded bitmap. If custom options are provided these will be used here