Byte array of image into imageview

后端 未结 2 1340
谎友^
谎友^ 2020-12-13 09:43

I\'ve searched a bit but can\'t get a clear glimpse of it. How can I set a byte array of an Image into an ImageView? I tried with this but it didn\'t work.

2条回答
  •  悲&欢浪女
    2020-12-13 10:11

    Get Bytes From Bitmap

        ByteArrayOutputStream stream = new ByteArrayOutputStream();
        bitmap.compress(Bitmap.CompressFormat.JPEG, 70, stream);
        byte[] bytearray = stream.toByteArray();
        return bytearray;
    

提交回复
热议问题