Android Question Can External Storage allow file selection?

JohnC

Expert
Licensed User
Longtime User
I am adding the ability to my app to allow the user to Export the app's settings, so a user can install my app on another device and simply Import the settings and be up and running.

So, I found this thread that seems like a good solution to allow the user to select a folder to "save" the exported ZIP file to:

https://www.b4x.com/android/forum/threads/externalstorage-access-sd-cards-and-usb-sticks.90238/

But when the user later wants to Import the ZIP file, I need a way to allow them to search for and select the zip file.

The above ExternalStorage feature looks like it could also be used for this purpose because when the devices "Folder Browser" is launched, it displays files and not just folders. And you can tap on one of the displayed files and it will change color, but it seems no event is executed, so the selected file is not returned.

I could use the secondary file list that is in the above example has (which, after the user selects a folder, the above example then creates a new file listview and allows the user to tap on an image and it will be displayed in the lower right). But this seems very counter-intuitive to show the user a list of files (that the folder browser shows) but only allow them to select just a folder, then display a totally different list containing the files in that folder (not to mention the UI colors between the two lists being totally different).

So, is there some parameter I could pass in the "android.intent.action.OPEN_DOCUMENT_TREE" intent that will allow the user to select a file?

Or, is there a better way to allow the user to select a ZIP file, but allow the user to browser locations like the external storage/USB and maybe even Google Drive?
 
Last edited:
Top