use*_*415 4 mp3 android android-intent
我正在尝试显示只有MP3文件:
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("audio/mp3");
startActivityForResult(Intent.createChooser(intent, "Music File"), FIND_MUSIC);
Run Code Online (Sandbox Code Playgroud)
但它最终还列出了*.3gp文件.我怎样才能仅限制*.mp3文件?
我已经尝试了setType("mp3")但是后来意图无法找到任何加载文件的应用程序.
您需要传递给setType以仅显示mp3文件的正确MIME类型是"audio/mpeg3"."audio/x-mpeg3"也应该有效.请查看此完整的MIME类型列表:http://reference.sitepoint.com/html/mime-types-full
“音频/mpeg3”对我不起作用。我记录了mp3的mime类型,
mimeType = android.webkit.MimeTypeMap.getSingleton().getMimeTypeFromExtension("mp3");
Log.e("mime:", mimeType);
Run Code Online (Sandbox Code Playgroud)
这是“音频/mpeg”
| 归档时间: |
|
| 查看次数: |
4176 次 |
| 最近记录: |