In my application i used to show to the user all the files with a specific extension available in his "Downloads" directory :
File dir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
return dir.listFiles(new FilenameFilter() {
public boolean accept(File dir, String name) {
return name.toLowerCase().endsWith(".ext");
}
});
It seems that this is not working anymore on android 11 and 10 (maybe below ?).
After investigation i found that listFiles()
or list()
now only return image file and not all the files as it used to be.
Almost like if a "default filter" was applied. Therefore my ".ext" files doesn't show anymore
What can i do to be able to see my ".ext" file and not only image file ?
Note that using the standard Filepicker to choose a file is not really an option , i have to stay in the app workflow.
question from:
https://stackoverflow.com/questions/65904491/listing-files-in-downloads-directory-is-limited-to-images 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…