I've a button on which I would like to open any file manager, and allow user to pick ONLY audio files. So i wrote something like this:
Intent intent = new Intent(); intent.setType("audio/*"); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(Intent.createChooser(intent, "Select audio", SELECTED_AUDIO);
However, this doesn't work - it opens file manager (in my case Astro) and voalaaa - I can see and also pick any files I want - I mean, text files, video files, etc. Simple it doesn't filter or check anything...What am I doing wrong? Or its fault of Astro? I just want to show only audio files, or show all files but allow to pick only audio.
preguntado el 25 de agosto de 12 a las 17:08
¿Qué estoy haciendo mal?
Or its fault of Astro?
Sort of. You assume that Astro knows the MIME type of all its files, and that it will actually use the MIME type to filter the results. There is nothing forcing Astro to do either of those things. The same holds true for any file manager or anything else that responds to
audio/*. Now, it would be agradable if Astro would do the filtering or something, but that's an issue you would have to take up with them.