Search code examples
androiddirectoryfile-transferdocumentsfile-access

Fill Documents directory manually on Android device


I have the following code returning YES in both cases:

File documents = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS);
Log.d("DOCUMENTS", documents.exists() ? "YES" : "NO");
File subdir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS) + "/bla");
subdir.mkdir();
Log.d("DOCUMENTS","SUBDIR EXISTS " + (subdir.exists() ? "YES" : "NO"));

So the Environment.DIRECTORY_DOCUMENTS seems to exist on my device. But how can I add files to it manually for example with the Android File Transfer tool? Where is this directory located on my files system? I can't find it. I can see folders like Music and DCIM but nothing like Documents. Thanks.


Solution

  • I just found that: https://android.stackexchange.com/questions/46315/not-all-files-are-visible-over-mtp

    It seems to be an known bug, that not all directories show up using MTP, the protocol the Android File Transfer actually uses. Rebooting the device worked for me.