My android device requests to the server a png image. The server encodes the image in Base64 and sends it to my device. After that, I decode the Base64 string into a byte array and use BitmapFactory.decodeByteArray() to make a Bitmap image of it. I can't see the image when I add it in an ImageView.
See below for the code:
JSONObject params = resultObject.getJSONObject("params");
byte[] decodedImageInBytes = Base64.decode(params.getString("image_one"), Base64.DEFAULT);
Bitmap myImage = BitmapFactory.decodeByteArray(decodedImageInBytes, 0, decodedImageInBytes.length);
ImageView imageViewOne = (ImageView) findViewById(R.id.imageViewOne);
imageViewOne.setImageBitmap(myImage);
Edit:
It seems that my code is okay, I have some problems with the server. Thanks everyone!