I'm trying to display just MP3 files with:
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("audio/mp3");
startActivityForResult(Intent.createChooser(intent, "Music File"), FIND_MUSIC);
But it ends up listing *.3gp files as well. How can I limit to just *.mp3 files only?
I've tried setType("mp3") but then the intent isn't able to find any app that loads the file.
The correct MIME type you need to pass to setType to show only mp3 files is "audio/mpeg3". Also "audio/x-mpeg3" should work. Check this out for a full list of MIME types: http://reference.sitepoint.com/html/mime-types-full
"audio/mpeg3" did not work for me. I logged the mime type of mp3,
mimeType = android.webkit.MimeTypeMap.getSingleton().getMimeTypeFromExtension("mp3");
Log.e("mime:", mimeType);
It was "audio/mpeg"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With