I'm trying to figure out how to add the following data to my json object. Could someone show me how to do this.
{ "main_img":"Base64 String" }
However, the following is the result of using this code, to come out.
final int COMPRESSION_QUALITY = 100;
String encodedImage;
ByteArrayOutputStream byteArrayBitmapStream = new ByteArrayOutputStream();
bitmapPicture.compress(Bitmap.CompressFormat.JPEG, COMPRESSION_QUALITY,
byteArrayBitmapStream);
byte[] b = byteArrayBitmapStream.toByteArray();
encodedImage = "data:image/JPEG;base64," + Base64.encodeToString(b, Base64.DEFAULT);
return encodedImage;
{ "main_img":"Base64 String
It is displayed with }, " is missing.
.
stackoverflow.comm
No comments:
Post a Comment