これは mp3 ファイルのタグ内の画像です http://i.stack.imgur.com/HtXqA.jpg
Android の MediaMetaDataRetreiver を使用して mp3 ファイルからこの画像バイト配列を取得します ... BitmapFactory.decodeByteArray を使用してこの画像をデコードしようとすると、null が返されます
助けていただければ幸いです
編集: options.inJustDecodeBounds = true で最初にデコードするとき ... options.outWidth と options.outHeight は正しい幅と高さを返します
完全なコード:
MediaMetadataRetriever retriever = new MediaMetadataRetriever();
retriever.setDataSource(context, songUri);
byte[] data = retriever.getEmbeddedPicture();
if(data != null)
{
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeByteArray(data, 0, data.length, options);
options.inSampleSize = BitmapUtils.calculateInSampleSize(options, 500, 500);
options.inJustDecodeBounds = false;
albumArtBitmap = BitmapFactory.decodeByteArray(data, 0, data.length, options);
}