如何显示专辑封面的MP3? [英] How to display album art for MP3?
问题描述
我尝试过2个天,可即使我真的不能显示我的MP3文件的专辑封面。 MP3文件位于 R.raw.t
。谁能帮我这个?
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 anyone help me with this?
推荐答案
据接缝,给定链接到Android音乐播放器,应用程序无法使用了。但是,在GitHub镜像可以发现这里。
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.
如果我们现在采取的<一看href=\"https://github.com/android/platform_packages_apps_music/blob/master/src/com/android/music/MusicUtils.java\"相对=nofollow>MusicUtils'级,我们看到相册ID来自被称为对象'sService',这是一个IMediaPlaybackService'-实例。这是一个AIDL-文件,让我们来看看在<一实施href=\"https://github.com/android/platform_packages_apps_music/blob/master/src/com/android/music/MediaPlaybackService.java\"相对=nofollow>MediaPlaybackService'级。
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.
原来这就是'getAlbumID() - 方法,我们发现:
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是一个标准的Android内容提供商,这是记载
这篇关于如何显示专辑封面的MP3?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!