Skip to content

Commit

Permalink
Merge pull request #926 from AdamGrzybkowski/adam/issue_546
Browse files Browse the repository at this point in the history
Fix: Use "rwt" file mode for the output image file
  • Loading branch information
lynnik authored Nov 29, 2024
2 parents 17fd3fe + a24b486 commit 369d5d9
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ public class BitmapCropTask extends AsyncTask<Void, Void, Throwable> {

private static final String CONTENT_SCHEME = "content";

private static final String READ_WRITE_AND_TRUNCATE = "rwt";

private final WeakReference<Context> mContext;

private Bitmap mViewBitmap;
Expand Down Expand Up @@ -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());
Expand Down

0 comments on commit 369d5d9

Please sign in to comment.