in my application, I try to save a bitmap with MediaStore.Images.Media.insertImage, and I try to configure the selection of the created file name using this method, but after passing any file name as String, this method creates an arbitrary file name, and I can not change it, for example, in this code I want to create "123456"and save it
String path = Environment.getExternalStorageDirectory().toString();
OutputStream fOut = null;
bitmapFileName = "123456";
File file = new File(path, bitmapFileName + ".jpg");
fOut = new FileOutputStream(file);
fOut.flush();
fOut.close();
drawView.getDrawingCache().compress(Bitmap.CompressFormat.JPEG, 85, fOut);
String imgSaved = null;
imgSaved = MediaStore.Images.Media.insertImage(getContentResolver(), file.getAbsolutePath(), file.getName(), file.getName());
after saving the image, this method creates the file name as 14524645878.jpg, rather than 123456.jpg, what is the problem? or how to find and get the witch file name created by this mthod
user4790312
source
share