开发者

create imageview from base64.decode

开发者 https://www.devze.com 2023-02-20 03:02 出处:网络
I have this problem: I want represent a base64 string to image that come from php page in my android application (the string base64 work fine and come good) so I have done this:

I have this problem: I want represent a base64 string to image that come from php page in my android application (the string base64 work fine and come good) so I have done this:

byte[] gzipBuff = Base64.decode(json_data.getString("immagine"),0);
ByteArrayInputStream memstream = new ByteArrayInputStream(gzipBuff, 0, gzipBuff.length);
ByteArrayOutputStream baos = new ByteArrayOutputStream(gzipBuff.length);
baos.write(gzipBuff);

Bitmap bmp = BitmapFactory.decodeStream(memstream);
ImageView开发者_开发百科 image = new ImageView(this);
image.setImageBitmap(bmp);

I don't see the imageview


A quick Google search finds one of your other duplicate questions as the first result, and this as the second. See the accepted answer from that question.

0

精彩评论

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