If you have files or folders created in the external storage directory, these can be displayed without any problem using a file browser or the same File Explorer
of Android Studio
.
Here the problem is that although you can view the files using File Explorer (File Explorer) , you can not programmatically read files or directories if you do not define the permission of WRITE_EXTERNAL_STORAGE , by defining this permission this implicit permission is READ_EXTERNAL_STORAGE
.
For versions of the Android operating system prior to 6.0, it is sufficient to define the permission within AndroidManifest.xml
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
For later versions of Android 6.0, it is also important to require the permissions manually.
In this question you can see a method to require permission:
Error when displaying the external file directory in an AlertDialog in android 6.0 (READ_EXTERNAL_STORAGE / WRITE_EXTERNAL_STORAGE)
Important to mention that in some versions of the Android operating system there is no "Documents" directory to which Environment.DIRECTORY_DOCUMENTS
relates, therefore it must first be created.
File folder = new File(Environment.getExternalStorageDirectory() + "/Documents");