2013-04-01 48 views
0

我现在正在研究一个简单的音乐播放器,我需要获取所有音频文件的缩略图。如何使用MediaStore获取音频文件的缩略图

String selection = MediaStore.Audio.Media.IS_MUSIC + " != 0"; 

    String[] projection = { 
      MediaStore.Audio.Media._ID, 
      MediaStore.Audio.Media.ARTIST, 
      MediaStore.Audio.Media.TITLE, 
      MediaStore.Audio.Media.DATA, 
      MediaStore.Audio.Media.DISPLAY_NAME, 
      MediaStore.Audio.Media.DURATION, 
      MediaStore.Audio.Media.YEAR 
    }; 
    cursor = getBaseContext().getContentResolver().query(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, 
      projection, selection, null, null); 
    while(cursor.moveToNext()) { 

     name.add(cursor.getString(4)); 
     path.add(cursor.getString(3)); 
     duration.add(cursor.getString(5)); 
    } 

我怎么能得到它?提前致谢。

回答

0

你可能想看看answer我给出了类似的问题。你需要给你的歌曲Uri以获得封面。

+0

他问'MediaStore',而不是'MediaMetadataRetriever' – user924

相关问题