User choose directory and I need get all audio files URIs in that directory.
I have directory URI something like this:
content://com.android.providers.downloads.documents/tree/downloads
When I try use ContentResolver method query I get an error:
Failure delivering result ResultInfo{who=null, request=9999, result=-1, data=Intent { dat=content://com.android.providers.downloads.documents/tree/downloads flg=0xc3 }} to activity {com.example.directorypicker/com.example.directorypicker.MainActivity}: java.lang.UnsupportedOperationException: Unsupported Uri content://com.android.providers.downloads.documents/tree/downloads
How to make URI supported?
Maybe you have alternative options?
Take the Uri
that you got from ACTION_OPEN_DOCUMENT_TREE
and pass it to DocumentFile.fromTreeUri()
. That will give you a DocumentFile
object, and you can call listFiles()
to traverse the document tree to find your audio content.