//从sqlite读取图片
Cursor query = readableDatabase.query("tb_press", null, null, null, null, null, null);
byte[] bytes = query.getBlob(1);
Bitmap bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
SQLiteDatabase db = dbOpenHelper.getWritableDatabase();
//写入sqlite
ContentValues values = new ContentValues();
Bitmap bit = BitmapFactory.decodeResource(getResources(), R.drawable.new3);
int size=bit.getWidth()*bit.getHeight()*4;
ByteArrayOutputStream os = new ByteArrayOutputStream(size);
bit.compress(Bitmap.CompressFormat.PNG, 100, os);
values.put("imgae", os.toByteArray());
long insert = db.insert("tb_press", null, values);
看下读取的byte数据是否为null,或者转换过程中有异常
Go