How to replace a bitmap after rotating the original image saved anywhere on the mobile device?

I want to replace a bitmap after rotating it, starting with the original image saved anywhere on the mobile device. I rotated the image 90 degrees, but I cannot replace it with the original image.

MediaStore.Images.Media.insertImage(getContentResolver(), rotatedBitmapImage, imageName, ""); 

I used the code above, but it saves the image in the DCIM → camera folder. But I want to replace it with the URI of the original image.

+4
source share
1 answer

I have an answer to this question. Despite using the above code, I used:

 OutputStream fOut = null; File file = new File(imagePath); try { fOut = new FileOutputStream(file); } catch (FileNotFoundException e) { e.printStackTrace(); } resizeBitmap.compress(Bitmap.CompressFormat.JPEG, 85, fOut); //---------------Used Media Scanner----------- sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri .parse("file://" + Environment.getExternalStorageDirectory()))); 
+6
source

Source: https://habr.com/ru/post/1437934/


All Articles