public Bitmap getImage(String name)
{
SQLiteDatabase db=this.getWritableDatabase();
Bitmap bt=null;
Cursor cursor=db.rawQuery("select photo from taskregist where name=?",new String[]{name});
if (cursor.moveToFirst())
{
byte [] image=cursor.getBlob(0);
bt=BitmapFactory.decodeByteArray(image,0,image.length);
}
return bt;
}
以下是设置imageview.provide解决方案的代码。先感谢您。
Imageview.setImageBitmap(dataHelper.getImage(nm));
它为BitmapFactory返回null。
尝试以下代码来获取。这里PHOTO是列名
byte [] image= cursor.getBlob(cursor.getColumnIndex(PHOTO));
还要验证数据是否已正确保存到DB