I'm trying to save pictures in a subfolder on Android. Here's a bit of my code:
File path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM); path = new File(path, "SubDirName"); path.mkdirs();
getExternalStorageDirectory instead of
getExternalStoragePublicDirectory and the Pictures folder instead of DCIM.)
Any subfolder I add, including its contents, don't show up in Windows Explorer when the device is connected via USB. It does show in the Android File Manager, though.
I've tried broadcasting the
ACTION_MEDIA_MOUNTED intent on the new directory's parent. It didn't work.
If I add a file in Windows, it shows up on Android. If I add a file on Android via the File Manager, it shows up in Windows. If I add the file programmatically, it shows up on the Android File Manager, but not in Windows Explorer. And I need to get it from Windows, and I don't want the final user to have to create the folder manually.
What am I doing wrong?