Tuesday, April 23, 2013

[android help] Add Convert to JSONObject


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

Google Voice on T-Mobile? [General]

Google Voice on T-Mobile? So I recently switched from a GNex on Verizon to a Moto X DE on T-Mobile. I had always used Google Voice for my v...