I have code for inserting Bitmap to sqlite database below. If I put byte[] object into content values the query insert is unsuccessful, it returns -1, but if I comment on the line cv.put(CagTablePictures.CAG_FIELD_PICTURE, byteArray);
, the insert is success. Where is the mistake? thanks.
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream);
byte[] byteArray = stream.toByteArray();
ContentValues cv = new ContentValues();
cv.put(CagTablePictures.CAG_FIELD_NAME, "Bitmap_" + n);
cv.put(CagTablePictures.CAG_FIELD_PICTURE, byteArray);
long id = mDatabase.insert(CAGLayerManager.CAG_TABLE_PICTURES, null, cv);