I want to create a hidden folder i.e .MyFolder [(dot)MyFolder] in DCIM directory. Here is my code:-
final String relativeLocation = Environment.DIRECTORY_DCIM+File.separator+".MyFolder/images";
ContentValues contentValues = new ContentValues();
contentValues.put(MediaStore.MediaColumns.DISPLAY_NAME,positionOfPager+".jpeg");
contentValues.put(MediaStore.MediaColumns.MIME_TYPE,"image/*");
contentValues.put(MediaStore.MediaColumns.RELATIVE_PATH,relativeLocation);
imageUri = context.getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,contentValues);
fos = (FileOutputStream) context.getContentResolver().openOutputStream(Objects.requireNonNull(imageUri));
inImage.compress(Bitmap.CompressFormat.JPEG,100,fos);
The problem here is that a folder is create with Hyphen symbol "_.MyFolder" i.e.[(Hypen)(dot)MyFolder] due to which the folder is not hidden. My app is creating lots of images which i dont want to show up in gallery to bother the user. Please help me out Note:- I am implementing the code for scoped storage android 11