일단 디비에 심을때 처리
if (sb.get(i)) {
BitmapDrawable drawable = (BitmapDrawable)arItem.get(i).Icon;
Bitmap bitmap_ico = drawable.getBitmap();
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bitmap_ico.compress(Bitmap.CompressFormat.PNG, 100, stream);
byte [] imageInByte = stream.toByteArray();
a_db.sql_query("INSERT INTO test VALUES (null, '"+arItem.get(i).a+"', '"+arItem.get(i).b+"', '"+imageInByte+"');");
}
참고로 imageInByte 를 파일화해서 sd카드에 저장햇을때는 정상적인 이미지로 출력됩니다
하지만
public ArrayList<Bitmap> select_ArrayList_Bitmap(String sql) {
db = this.getWritableDatabase();
Cursor cursor;
cursor = db.rawQuery(sql, null);
ArrayList<Bitmap> arGeneral = null;
arGeneral = new ArrayList<Bitmap>();
while (cursor.moveToNext()) {
byte[] bitimg = cursor.getBlob(0);
if(bitimg!=null) {
Bitmap bitmap = BitmapFactory.decodeByteArray(bitimg, 0, bitimg.length);
arGeneral.add(bitmap);
}
}
cursor.close();
this.close();
return arGeneral;
}
으로 비트맵을 추출했는데 여기서 나온 이미지는 까만화면 아니면 깨지는것 같은데 원인이 몰까요?
참고로 필드 속성은 blob 입니다
저도 최근에 blob이미지 하는거 써봐는데 잘불러오던데여
byte[] bitimg = cursor.getBlob(0); 이거 이미지 컬럼 맞는지 확인해보세요