Edit: When I save these bytes in a txt file, and when I save it as a png file, it shows an image, but it doesn't work here, why ...?
I use this code to create an image from an array of bytes on doInBackground ()
String base64data=StringEscapeUtils.unescapeJava(IOUtils.toString(resp.getEntity().getContent()));
base64data=base64data.substring(1,base64data.length()-1);
JSONObject obj=new JSONObject(base64data);
JSONArray array=obj.getJSONArray("EMRTable");
JSONObject childobj=array.getJSONObject(0);
results=childobj.getString("DocumentInternalFormat");
and onPostExecute
if(jsondata!=null) {
receiveData(jsondata);
}
There is no error in logcat, even there is no exception ... but the image is not displayed. I also liked
String data=(String)object;
data=data.trim();
byte[] base64converted=Base64.decode(data,Base64.DEFAULT);
ImageView image=new ImageView(context);
image.setImageBitmap(bmp);
setContentView(image);
but the result of the image is not displayed, but there is no exception or error, what is the problem ...
Numbered lines are when I try to save these bytes in a text file, and when I pull out the file, it displays the images using the default Windows image viewer.