我试图只显示 MP3 文件:
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("audio/mp3");
startActivityForResult(Intent.createChooser(intent, "Music File"), FIND_MUSIC);
但它最终也列出了 *.3gp 文件。如何限制为仅 *.mp3 文件?
我已经尝试过 setType("mp3"),但 Intent 无法找到任何加载该文件的应用。
最佳答案
您需要传递给 setType 以仅显示 mp3 文件的正确 MIME 类型是“audio/mpeg3”。 “audio/x-mpeg3”也应该可以工作。查看此 MIME 类型的完整列表:http://reference.sitepoint.com/html/mime-types-full
关于Android 仅显示带有 ACTION_GET_CONTENT 的 mp3,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7643928/