I am storing an image in internal storage. I have a bitmap. but it is also storing a copy of that image in pictures folder named with the time stamp. please help me on that.
private void saveBitmapCropped(Bitmap bitmap,String uid){
String path = Environment.getExternalStorageDirectory().toString();
File file=new File(path+"/.Cropped_images",uid+".jpg");
OutputStream fOut = null;
saveRes(String.valueOf(Uri.fromFile(file)),"uri");
try {
fOut = new FileOutputStream(file);
Bitmap pictureBitmap = bitmap;
pictureBitmap.compress(Bitmap.CompressFormat.JPEG, 85, fOut); // saving the Bitmap to a file compressed as a JPEG with 85% compression rate
fOut.flush();
fOut.close();
MediaStore.Images.Media.insertImage(getContentResolver(),file.getAbsolutePath(),file.getName(),file.getName());
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}