2014-04-13 5 views

답변

3

Android는이를 "트랙 이미지"가 아니라 "앨범 이미지"로 저장합니다. 그래서 당신은 앨범 데이터를 다른 쿼리를 할 필요가 : "albumArt"문자열의 종류 또는 그 경로 가정 bitmap.i 무엇

long albumId = cursor.getLong(7); 
Cursor artCursor = context.getContentResolver().query(
     MediaStore.Audio.Albums.EXTERNAL_CONTENT_URI, 
     new String[] {MediaStore.Audio.AlbumColumns.ALBUM_ART}, 
     MediaStore.Audio.Media._ID+" =?", 
     new String[]{String.valueOf(albumId)}, 
     null); 
String albumArt; 
if(artCursor.moveToNext()) { 
    albumArt = "file://"+artCursor.getString(0); 
} else { 
    albumArt = null; 
} 
artCursor.close(); 

if(albumArt != null) { 
    BitmapFactory.decodeFile(new File(albumArt)); 
} 
+0

:

ALBUMID는 노래를로드 커서에서 온다 앨범 이미지의. 그러나 나는 그 길에서 이미지를 어떻게 얻을 수 있냐? – user3302257

+0

예, 경로입니다. 비트 맵을 얻으려면 BitmapFactory.decodeFile (새 파일 (앨범 아트));'을 사용합니다. –