Here is the code:
private File createImageFile() throws IOException { // Create an image file name StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.setVmPolicy(builder.build()); @SuppressLint("SimpleDateFormat") String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()); String imageFileName = MainActivity.login + "_" + timeStamp; File storageDir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM).getPath(), "file_folder"); if (!storageDir.exists()) { storageDir.mkdir(); Log.e("SD", storageDir.exists() + ""); } File image = File.createTempFile(imageFileName, ".jpg", storageDir); return image; } With the help of the explorer, I found the directory created, and the file (img), but they do not appear in the gallery.
Please explain what you need to do to the catalog and photos displayed in the gallery.
MediaScannerConnection.scanFile(CreateClientActivity.this, new String[]{ image.getAbsolutePath() }, null, null);- not a folder, but transfer the file (s) to it. - woesss