android获取本地音乐的专辑的图片

 

String[] mediaColumns1 = new String[] {MediaStore.Audio.Albums.ALBUM_ART, MediaStore.Audio.Albums.ALBUM}; 
    
        Cursor cursor1 = getContentResolver().query(MediaStore.Audio.Albums.EXTERNAL_CONTENT_URI, mediaColumns1, null, null,
                null); 
        
        if (cursor1 != null) {
            cursor1.moveToFirst();
            do {
                String album_art =  cursor1.getString(0);
                if (album_art != null) {
                    Log.d("ALBUM_ART", album_art);
                }
                
                String album =  cursor1.getString(1);
                if (album != null) {
                    Log.d("ALBUM_ART", album);
                }
                
            } while (cursor1.moveToNext());
            
            cursor1.close();
        }

 

album_art就是图片的路径,每首歌曲的图片就是他的专辑的图片

posted on 2012-04-11 16:50  碎羽Orz  阅读(1435)  评论(0编辑  收藏  举报

导航