Get Blob image and convert that image into Bitmap image

前端 未结 2 620
野性不改
野性不改 2020-12-31 17:19

I am getting image from database in blob format. i want to convert it into Bitmap image.the code i used to convert bitmap to Blob is put below.but please tell me how to reve

相关标签:
2条回答
  • 2020-12-31 17:52

    This will work

    byte[] byteArray = DBcursor.getBlob(columnIndex);  
    
    Bitmap bm = BitmapFactory.decodeByteArray(byteArray, 0 ,byteArray.length);
    
    0 讨论(0)
  • 2020-12-31 17:56

    Why not make a helper method like that :)

    public static Bitmap getBitmapFromBytes(byte[] bytes) {
            if (bytes != null) {
                return BitmapFactory.decodeByteArray(bytes, 0 ,bytes.length);
            }
            return null;
     }
    
    0 讨论(0)
提交回复
热议问题