I have an sqlite database that has a blob column with blob data. I hav开发者_开发技巧e tried the following but it is not showing anything. Please advice:
public Cursor getHiddenImages()
{
dbConnection connection=new dbConnection(getApplicationContext());
SQLiteDatabase db=connection.getReadableDatabase();
Cursor cursor=db.query(dbConnection.TABLE_IMAGES,null, null, null, null, null, null);
return cursor;
}
cursor=getHiddenImages();
cursor.moveToFirst();
byte[]mybyteArray=cursor.getBlob(cursor.getColumnIndex(dbConnection.IMAGE_DATA));
Bitmap theImage=BitmapFactory.decodeByteArray(mybyteArray, 0, mybyteArray.length);
imageview.setImageBitmap(theImage);
Try this code and also check the below links,
Buffer = Cursor1.GetBlob("Image")
Dim Canvas1 As Canvas
Canvas1.Initialize(ImageView1)
Dim IN As InputStream
IN.InitializeFromBytesArray(Buffer,0,Buffer.Length)
IN.Close
Msgbox(buffer.Length,"Image lenght")
Msgbox(In.BytesAvailable,"available")
Canvas1.Bitmap.Initialize2(IN)
ImageView1.Bitmap = Canvas1.Bitmap
Check out these links u can solve ur prob.
Assignin blob to imageview
display image from blob
Blob to imageView
精彩评论