我希望在旋转后替换位图图像,从存储在移动设备中的任何位置的原始图像。我已将图像旋转90度,但我无法将其替换为原始图像。
MediaStore.Images.Media.insertImage(getContentResolver(), rotatedBitmapImage, imageName, "");
我使用了上面的代码,但它将图像存储在DCIM中 - >相机文件夹。但我想将其替换为原始图像的URI。
答案 0 :(得分: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())));