我有以下代码来获取设备中的所有音乐。我的设备已通过Google's Play Music app下载了音乐..但这些文件不会显示..任何想法为什么......
这是我的代码:
String[] musicProjParams = { MediaStore.Audio.Media._ID,
MediaStore.Audio.Media.DATA,
MediaStore.Audio.Media.DISPLAY_NAME,
MediaStore.Audio.Media.TITLE,
MediaStore.Video.Media.SIZE,
MediaStore.Audio.Media.MIME_TYPE,
MediaStore.Audio.Media.ALBUM,
MediaStore.Audio.Media.ALBUM_ID,
MediaStore.Audio.Media.ARTIST};
//String[] cont = { "audio/mpeg" };
String selection = MediaStore.Audio.Media.IS_MUSIC + " != 0";
musicCursor = getContentResolver().query(
MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, musicProjParams,
selection,
null,
"UPPER(" +MediaStore.Audio.Media.TITLE + " )ASC");
mAdapter = new DRPMusicFromPhoneAdapter(getApplicationContext(),
android.R.layout.simple_list_item_1, musicCursor,
new String[] { "_id, MediaStore.Audio.Media.TITLE" },
new int[] { android.R.id.text1 },albumArtMap);
_searchResultsView.setAdapter(mAdapter);