Choose directory via FilePicker

My app is playing sound files from a directory. I have set a global variable to the directory


This all works fine. Now I want the user to choose a directory. I have tried FilePicker.Open, FilePicker.AfterPicking with action set to Pick Directory and send FilePicker.Selection to a label. If I navigate to the above mentioned directory, I would have expected the same directory as output in the label. But instead I find


Have I done anything wrong? What should I do instead?

Or could I simply cut and join the string to fit the above directory?

Show your blocks.

See also here:

Try this:

If I do "as you say you do", I get this:


The filepicker returns a contenturi. This should work in most settings. It is Android's way of not using a file path that we all understand :wink:

Where does /storage/emulated/0 come from in your path ?

Thank you @TIMAI2. I have set up the blocks again, starting from your "as I said I did". Now I get the expected result. No idea, where the rest of the string came from...

And thank you @Anke. That's more or less what I have done before, too, to receive the directory from the string.

Most likely due to the use of one of the two file extensions. And it would actually make sense to list audio files in the respective directory in order to then play an audio track from it.


But of course this doesn't work with a contentUri, hence my suggestion to extract the real path from contentUri.

Ok, and then...what next?

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.