0
我想插入一個只包括0和1的blob。但它不工作。 首先我得到一個位圖,轉換爲二進制圖像。之後,我想以blob的形式插入數據庫。但數據庫的行是空的。 這裏的代碼是;Android的Sqlite插入blob
Otsu(retpix,picw,pich);
byte[] byteimage = new byte[length << 2];
for (int di=0; di<144; di++) {
int x = retpix[di];
int j = di << 2;
byteimage[j++] = (byte) ((x >>> 0) & 0xff);
byteimage[j++] = (byte) ((x >>> 8) & 0xff);
byteimage[j++] = (byte) ((x >>> 16) & 0xff);
byteimage[j++] = (byte) ((x >>> 24) & 0xff);
}
String PutName = "imagearray";
cv.put(PutName, byteimage);
db.insert("IMAGES", null, cv);
db.close();