开发者

getting blob data and using imageView as its container

开发者 https://www.devze.com 2023-03-18 03:36 出处:网络
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:

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

0

精彩评论

暂无评论...
验证码 换一张
取 消