Question

I want to ask user to select a file to open from external storage and receive it's path. Preferably I'd like to avoid excesive coding and use some standard method (well known, system-provided intent or similar). Said file is to be SpatiaLite db file (*.sqlite), so it won't show in Gallery.

Was it helpful?

Solution

Unfortunately there is no Android native file picker, but you can get an open-source one to add in your project, then modify it to fit your needs. Check out this SO question for a good start.

OTHER TIPS

I would also suggest that Android file pickers have intents that you can feel free to use. Unfortunately if the user does not have the proper apps on their device, your intent will not succeed. If this happens, you can always direct the user to download the app. Alternatively, you can check if the file picking intent will succeed (see this advice), and use the standard file picker if so (many users have ASTRO, for example, which I think has an intent you can use), and you can fall back on something included in your app, this will make for a perhaps nicer end to end user experience across apps on their device.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top