public static Bitmap decodeStream(final ContentResolver resolver,final Uri uri,final int maxSize){
  Bitmap result=null;
  final InputStreamFactory factory=createInputStreamFactory(resolver,uri);
  try {
    final Point bounds=getImageBounds(factory);
    if (bounds == null) {
      return result;
    }
    final BitmapFactory.Options opts=new BitmapFactory.Options();
    opts.inSampleSize=Math.max(bounds.x / maxSize,bounds.y / maxSize);
    result=decodeStream(factory,null,opts);
    return result;
  }
 catch (  FileNotFoundException exception) {
  }
catch (  IOException exception) {
  }
catch (  IllegalArgumentException exception) {
  }
catch (  SecurityException exception) {
  }
  return result;
}

public static Bitmap decodeStream ( final ContentResolver resolver , final Uri uri , final int maxSize ) { Bitmap result = null ; final InputStreamFactory factory = createInputStreamFactory ( resolver , uri ) ; try { final Point bounds = getImageBounds ( factory ) ; if ( bounds == null ) { return result ; } final BitmapFactory . Options opts = new BitmapFactory . Options ( ) ; opts . inSampleSize = Math . max ( bounds . x / maxSize , bounds . y / maxSize ) ; result = decodeStream ( factory , null , opts ) ; return result ; } catch ( FileNotFoundException exception ) { } catch ( IOException exception ) { } catch ( IllegalArgumentException exception ) { } catch ( SecurityException exception ) { } return result ; }
create a bitmap from a local uri
