0
//MyOpenHelper class 


public static final String TABLE_NAME2 = "Catlog_Chield";
db.execSQL("CREATE TABLE IF NOT EXISTS "+TABLE_NAME2+" (_id INTEGER PRIMARY KEY AUTOINCREMENT,log_desc TEXT,log_date TEXT,log_image BLOB,cat_id INTEGER,FOREIGN KEY (cat_id) REFERENCES "+TABLE_NAME1+"(_id))");

//My working class


 ByteArrayInputStream inputStream =   
    new ByteArrayInputStream(c.getBlob(c.getColumnIndex(log_image))); //Here I can't give my column name log_name
    Bitmap bp=BitmapFactory.decodeStream(inputStream);

    image.setImageBitmap(bp);
4

1 回答 1

0

请尝试这种方式:

   byte[] image_bytes = c.getBlog(c.getColumnIndex(Here you need to give index));
   ByteArrayInputStream inputStream =   
   new ByteArrayInputStream(image_bytes); 
   Bitmap bp=BitmapFactory.decodeStream(inputStream);

// 现在使用 setImageBitmap 方法设置图像

于 2012-07-26T12:30:49.470 回答