旋转存储在移动设备中任何位置的原始图像后,如何替换位图图像?

4 database media android replace android-camera

我希望在旋转后替换位图图像,从存储在移动设备中的任何位置的原始图像.我已将图像旋转90度,但我无法将其替换为原始图像.

MediaStore.Images.Media.insertImage(getContentResolver(), rotatedBitmapImage, imageName, "");
Run Code Online (Sandbox Code Playgroud)

我已经使用了上面的代码,但它将图像存储在DCIM - >相机文件夹中.但我想将其替换为原始图像的URI.

小智 6

我已经回答了这个问题.尽管使用了以上代码,我还是使用了:

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())));
Run Code Online (Sandbox Code Playgroud)