嗨,我的手机中有sdcard代码来获取列表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());
答案 0 :(得分:0)
使用以下代码段播放原始文件夹
中的音频文件MediaPlayer mPlayer;
mPlayer= MediaPlayer.create(this, R.raw.bg_music);
mPlayer.start();