[英]how to parse image base64 and jpeg from json using picasso
i'm trying to parse an image which is base64 or jpeg. 我正在尝试解析为base64或jpeg的图像。 i'm trying to parse base64 first with this code 我正在尝试使用此代码首先解析base64
if(ar.has("foto"))
{
byte[] decodedString = Base64.decode(ar.getString("foto", Base64.DEFAULT));
Bitmap decodedByte = BitmapFactory.decodeByteArray(decodedString, 0, decodedString.length);
}
but it says getString (String) in JSONObject cannot be applied to (String, int)
which is int
in red line. 但它说getString (String) in JSONObject cannot be applied to (String, int)
这是int
在红线。 it says error in this line of code ("foto", Base64.DEFAULT)
. 它说这行代码("foto", Base64.DEFAULT)
。 please help 请帮忙
change 更改
from : 来自:
byte[] decodedString = Base64.decode(ar.getString("foto", Base64.DEFAULT));
to : 至 :
byte[] decodedString = Base64.decode(ar.getString("foto"), Base64.DEFAULT);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.