If I try to get all DocumentFile
with DocumentFile.fromTreeUri()
it returns me only DocumentFiles
on the first level of the Uri
without the ones in the subfolders.
If in order to get also all DocumentFile
in sub folders, I try to check what DocumentFile
is a directory, recursively passing its Uri
in the method that uses DocumentFile.fromTreeUri()
, the whole procedure is extremely slow.
Is there a better way to do this (without methods that use classic storage access)?
EDIT
The approach above, actually it's not simply slow, but totally stuck.
This due to the fact the DocumentFile
objects of folders return always the root file list rather than their content list as supposed due to a weird SAF behavior explained here and this caused a loop.