Skip to content

Commit

Permalink
Use file mode for the output image file
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamGrzybkowski committed Aug 27, 2024
1 parent 17fd3fe commit 47bfbb9
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 WRITE_AND_TRUNCATE = "wt";

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, WRITE_AND_TRUNCATE);
outStream = new ByteArrayOutputStream();
croppedBitmap.compress(mCompressFormat, mCompressQuality, outStream);
outputStream.write(outStream.toByteArray());
Expand Down

0 comments on commit 47bfbb9

Please sign in to comment.