バイト配列があり、それを Android Drawable に変換する必要があります。
この変換を実行するにはどうすればよいですか?
私はこれを試しましたが、うまくいきません:
fileData
byte[]
配列です
Drawable image = null;
image = new BitmapDrawable(BitmapFactory.decodeByteArray(fileData, 0, fileData.length));
このコードを使用しました
byte[] imageByteArray = cursor.getBlob(cursor
.getColumnIndex(SQLiteAdapter.KEY_CONTENT11));
if (imageByteArray != null) {
ByteArrayInputStream imageStream = new ByteArrayInputStream(
imageByteArray);
Bitmap company_logo = BitmapFactory
.decodeStream(imageStream);
img_logo.setBackgroundDrawable(null);
img_logo.setBackgroundDrawable(new BitmapDrawable(
getResources(), company_logo));
}