public void handleCrop ( int resultCode , Intent result ) { if ( resultCode == Activity . RESULT_OK ) { Uri uri = Crop . getOutput ( result ) ; resultView . setImageURI ( uri ) ; InputStream inputStream = null ; try { inputStream = new FileInputStream ( uri . getPath ( ) ) ; Bitmap myBitmap = BitmapFactory . decodeStream ( inputStream ) ; myBitmap = Bitmap . createScaledBitmap ( myBitmap , 130 , 130 , false ) ; mContainer . setFieldValue ( ProfileField . PHOTO , myBitmap ) ; showPicture ( myBitmap ) ; } catch ( FileNotFoundException e ) { Log . e ( TAG , "handleCrop FileInputStream-file not found from uri.getpath" , e ) ; } finally { if ( inputStream != null ) { try { inputStream . close ( ) ; } catch ( IOException e ) { Log . e ( TAG , "handleCrop closing input stream error" , e ) ; } } } } else if ( resultCode == Crop . RESULT_ERROR ) { Toast . makeText ( this . getActivity ( ) , Crop . getError ( result ) . getMessage ( ) , Toast . LENGTH_SHORT ) . show ( ) ; } }
Method to set an show a cropped imaged .