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就是图片的路径,每首歌曲的图片就是他的专辑的图片

转载于:https://www.cnblogs.com/lienorz/archive/2012/04/11/2442634.html

你可能感兴趣的:(android获取本地音乐的专辑的图片)