Although having read and write permissions I am unable to access sdcard in Android 10. This was my approach to list all directory.
File root = new File("/mnt/sdcard/");
File[] subFiles = root.listFiles();
for(File file : subFiles) {
if(file.isDirectory()) {
String str = text.getText().toString() + "\n";
str+=file.getAbsolutePath();
text.setText(str);
}
}
If I use /mnt/ instead of /mnt/sdcard/ I can see sdcard directory is listed in there but when I use /mnt/sdcard/ , subFiles is null. I don't know if this is something regarding new android 10 version or it is a problem with emulator. I was using android studio's default emulator for debuging.