I am getting a base 64string from my api which Looks something like this:
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUg.....KUfsaX4AAAAASUVORK5CYII="
I Need to put the Image on a imageview. I tried following to place it on an imageview:
@BindView(R.id.zeichnung)
ImageView drawable1;
try {
String result = response.body().string(); // result holds the Image above
byte[] decodedString = Base64.decode(result, Base64.DEFAULT);
Bitmap decodedByte = BitmapFactory.decodeByteArray(decodedString, 0, decodedString.length);
//Insert Image
drawable1.setImageBitmap(decodedByte);
} catch (Exception e) {
Toasty.error(VideoChatActivity.this, "ERROR.", Toast.LENGTH_SHORT, true).show();
}
But it keeps throwing me the catch toast.