Android Question Setting initial folder for the Folder Picker

noeleon

Member
Licensed User
How can I set the initial folder when I launch the folder picker?

B4X:
Dim i As Intent
i.Initialize("android.intent.action.OPEN_DOCUMENT_TREE", "")
i.putExtra ????????
StartActivityForResult(i)
I saw a post on the internet that use the following line but it does not work in B4A
putExtra("android.provider.extra.INITIAL_URI", folderUri)
 
Last edited:

noeleon

Member
Licensed User
How did you create folderUri?
It's the persistable uri from the Folder picker.

The problem is I also have a File picker using android.intent.action.GET_CONTENT and because they're using the same System UI/Activity the starting folder shown when it's launched is always the one last used. What I wanted was when the File Picker is launched the starting folder is the one where File Picker left off or a pre-set location. The same goes for the Folder Picker.

Anyway, I'll just make my own file/folder picker based on your sample project for the ExternalStorage class. I find using the system File Picker problematic if the user picks a file using third party file providers like TotalCMD, ZArchiver, etc., the ones on the side drawer of the file picker.
 
Top