How to display album art for MP3?
I tried 2 days full and even after that I really can't display my MP3 file's album art. The MP3 file is located in R.raw.t
. Can a开发者_JAVA技巧nyone help me with this?
Found this older Topic.
It seams, that the given link to the Android Music Player-App isn't available anymore. But, a Mirror on GitHub can be found here.
If we now take a look on the 'MusicUtils'-class, we see that the Album ID comes from an Object called 'sService', which is a 'IMediaPlaybackService'-Instance. This is an AIDL-File, so we look at the implementation in the 'MediaPlaybackService'-Class.
So this is the 'getAlbumID()'-method we find:
public long getAlbumId() {
synchronized (this) {
if (mCursor == null) {
return -1;
}
return mCursor.getLong(mCursor.getColumnIndexOrThrow(MediaStore.Audio.Media.ALBUM_ID));
}
}
'MediaStore' is a standard Android Content-Provider, which is documented here.
精彩评论