-1
您好我有代码哗哗得到的SD卡列表的MP3文件在我的手机, 我怎么可以将其更改为从原文件夹获取MP3播放MP3文件
public ArrayList<Track> getTracksOnMDS() {
Uri uri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
String[] projection = new String[] { MediaStore.Audio.Media._ID,
MediaStore.Audio.Media.TITLE, MediaStore.Audio.Media.ARTIST,
MediaStore.Audio.Media.ALBUM_ID, MediaStore.Audio.Media.DATA };
Cursor cursor = contentResolver
.query(uri, projection, null, null, null);
return convertMediaStoreCursorToArrayList(cursor);
}
我更换一些代码来做到这一点,但实在不行
File ring = new File("android.resource://com.bk.lrandom/res/raw/_10.mp3");
Uri uri = MediaStore.Audio.Media.getContentUriForPath(ring.getAbsolutePath());
我没有看到任何实际播放音频文件的代码。 –
是的,没有任何代码播放MP3文件 –
原始资源不是在运行时的文件,所以你不能为它们获取一个File对象。 –