byte[] imageInByte;
ImageView iViewAddImage;
if (imageInByte.length>0) {
Bitmap bitmap = BitmapFactory.decodeByteArray(imageInByte, 0, imageInByte.length);
iViewAddImage.setImageBitmap(bitmap);
}
我得到了Bitmap
价值null
和 imageInByte.length=20621
.
做错了什么。建议我?
编辑 1:
public void insertImage(byte[] imageInByte2)
{
if(sqliteDb != null)
{
try {
sqliteDb.insert("database",null,getDataValues(imageInByte2));
} catch(Exception e) {
e.printStackTrace();
}
}
}
private ContentValues getDataValues(byte[] imageInByte2){
ContentValues contentValues = new ContentValues();
try {
contentValues.put("image",imageInByte2);
}
catch (Exception e) {
e.printStackTrace();
}
return contentValues;
}