File browser on android

I’m wondering what the options are for giving the user a “browse for directory/file(s)” on android. The modal based browsers I use right now aren’t supported on android from what I’ve read, so I’m wondering what alternatives I have. I’ve searched through the threads and found that JUCE was recently updated with a native file chooser. Will this work for files and folders, and where in the framework can I find the classes I should be using? Sorry if this is a really open ended question, I just think I’d get a better sense of where to start by doing this than scouring the JUCE framework myself.

This is what the application looks like by the way. The program currently uses one multi-file browser, one single-file browser, and two single-directory browsers.

Hi, check out the demo app for details on how to use the file browsers.

There’s also a lot of info in this thread if you’re willing to pick through it:

1 Like

Yup, as @leehu says, the topic linked and JUCE demo app (more specifically its Dialogs Demo) should give you enough information to get going.

I’m sorry, but I just looked over JUCE\examples\Demo\Source\Demos\DialogsDemo.cpp and it does not help. The code for handling file/folder browsing is inside an if/endif directive.

#if JUCE_MODAL_LOOPS_PERMITTED
const bool useNativeVersion = nativeButton.getToggleState();

if (type == loadChooser) {
    {...snip...}
}
else if (type == loadWithPreviewChooser) {
    {...snip...}
}
else if (type == saveChooser) {
    {...snip...}
}
else if (type == directoryChooser) {
    {...snip...}
}
#endif

meaning the example code will be omitted from compilation on android.

I’ll scour through the native file chooser thread to see what I can find. I would still very much appreciate if someone with experience making working file choosers appear on android would chime in. Thanks.

My DialogsDemo.cpp doesn’t have that - are you on develop?

No. I’m looking at the master branch.

Is the android native filechooser code only on the develop branch? If so, is it stable enough for me to use? If the code is already in the master branch, should I just use the develop branch for reference?

Yes, all the new browser stuff is only on develop. It’s stable now and there haven’t been any issues reported for some time.

1 Like

Thanks. Guess I’ll actually clone the repo instead of just downloading the master branch.