passy / Android-DirectoryChooser

A directory chooser library for Android.
Apache License 2.0
515 stars 144 forks source link

Folders are not showing up #130

Open abdalmoniem opened 4 years ago

abdalmoniem commented 4 years ago

Hello,

I'm using the below code to show directories:

Log.d("mn3m", "Internal SD Card Path: " + StorageUtils.getAllStorageLocations().get("sdCard").getAbsolutePath());

Intent chooserIntent = new Intent(this, DirectoryChooserActivity.class);

DirectoryChooserConfig config = DirectoryChooserConfig.builder()
                                .newDirectoryName("DialogSample")
                                .allowNewDirectoryNameModification(true)
                                .allowReadOnlyDirectory(true) 
                                .initialDirectory(StorageUtils.getAllStorageLocations()
                                                              .get("sdCard").getAbsolutePath())
                                .build();

chooserIntent.putExtra(DirectoryChooserActivity.EXTRA_CONFIG, config);

// REQUEST_DIRECTORY is a constant integer to identify the request, e.g. 0
(chooserIntent, 10);

the output of this log is:

2020-05-09 21:50:56.546 13600-13600/pct.droid.dev D/mn3m: Internal SD Card Path: /storage/emulated/0

when I use the above code, I get a new activity with EMPTY view, no directories are shown, I'm using android 10 on a OnePlus 6T device, permissions are granted and DialogChooserActivity is added in AndroidManifest.xml

gstraymond commented 4 years ago

Have the same problem, seems related to scoped storage introduced in Android 10 and enabled in Android 11 https://medium.com/androiddevelopers/android-11-storage-faq-78cefea52b7c