我也在修改android原生代码。模拟器始终没成功 public void handleMessage(Message msg) { long albumid = ((AlbumSongIdWrapper) msg.obj).albumid; long songid = ((AlbumSongIdWrapper) msg.obj).songid; if (msg.what == GET_ALBUM_ART && (mAlbumId != albumid || albumid < 0 || mIsShowAlbumArt)) { Message numsg = null; // while decoding the new image, show the default album art if (mArtBitmap == null || mArtSongId != songid) { numsg = mHandler.obtainMessage(ALBUM_ART_DECODED, null); mHandler.removeMessages(ALBUM_ART_DECODED); mHandler.sendMessageDelayed(numsg, 300); // Don't allow default artwork here, because we want to fall back to song-specific // album art if we can't find anything for the album. // add by jackie: if don't get album art from file,or the album art is not the same as // the song ,we should get the album art again mArtBitmap = MusicUtils.getArtwork(MediaPlaybackActivity.this, songid, albumid, false); MusicLogUtils.d(TAG, "get art. mArtSongId = " + mArtSongId + " ,songid = " + songid + " "); mArtSongId = songid; }
Cursor cursor = managedQuery( MediaStore.Audio.Media.EXTERNAL_CONTENT_URI,
projection,
null,
null,
null);
int columnIndex = cursor.getColumnIndexOrThrow(MediaStore.Audio.Media.DATA);
cursor.moveToFirst();
String audioPath = cursor.getString(columnIndex); 不知道有没有用
{
long albumid = ((AlbumSongIdWrapper) msg.obj).albumid;
long songid = ((AlbumSongIdWrapper) msg.obj).songid;
if (msg.what == GET_ALBUM_ART && (mAlbumId != albumid || albumid < 0 || mIsShowAlbumArt)) {
Message numsg = null;
// while decoding the new image, show the default album art
if (mArtBitmap == null || mArtSongId != songid) {
numsg = mHandler.obtainMessage(ALBUM_ART_DECODED, null);
mHandler.removeMessages(ALBUM_ART_DECODED);
mHandler.sendMessageDelayed(numsg, 300); // Don't allow default artwork here, because we want to fall back to song-specific
// album art if we can't find anything for the album.
// add by jackie: if don't get album art from file,or the album art is not the same as
// the song ,we should get the album art again
mArtBitmap = MusicUtils.getArtwork(MediaPlaybackActivity.this, songid, albumid, false);
MusicLogUtils.d(TAG, "get art. mArtSongId = " + mArtSongId + " ,songid = " + songid + " ");
mArtSongId = songid;
}
if (mArtBitmap == null) {
mArtBitmap = MusicUtils.getDefaultArtwork(MediaPlaybackActivity.this);
albumid = -1;
}
if (mArtBitmap != null) {
numsg = mHandler.obtainMessage(ALBUM_ART_DECODED, mArtBitmap);
mHandler.removeMessages(ALBUM_ART_DECODED);
mHandler.sendMessage(numsg);
}
mAlbumId = albumid;
mIsShowAlbumArt = false;
}
}这应该是获取图片。楼主解决没?分享下