diff --git a/ucrop/src/main/java/com/yalantis/ucrop/task/BitmapCropTask.java b/ucrop/src/main/java/com/yalantis/ucrop/task/BitmapCropTask.java index c2f34d51..73d9aff3 100644 --- a/ucrop/src/main/java/com/yalantis/ucrop/task/BitmapCropTask.java +++ b/ucrop/src/main/java/com/yalantis/ucrop/task/BitmapCropTask.java @@ -40,6 +40,8 @@ public class BitmapCropTask extends AsyncTask { private static final String CONTENT_SCHEME = "content"; + private static final String READ_WRITE_AND_TRUNCATE = "rwt"; + private final WeakReference mContext; private Bitmap mViewBitmap; @@ -213,7 +215,7 @@ private void saveImage(@NonNull Bitmap croppedBitmap) { OutputStream outputStream = null; ByteArrayOutputStream outStream = null; try { - outputStream = context.getContentResolver().openOutputStream(mImageOutputUri); + outputStream = context.getContentResolver().openOutputStream(mImageOutputUri, READ_WRITE_AND_TRUNCATE); outStream = new ByteArrayOutputStream(); croppedBitmap.compress(mCompressFormat, mCompressQuality, outStream); outputStream.write(outStream.toByteArray());