camera - Android code to convert base64 string to bitmap -


Stackoverflow Team I have a problem changing the base64 string to Bitmap in Android.

Believing that your image data is in a string called myImageData, the following should do the trick :

  byte [] imageAsBytes = Base64.decode (myImageData.getBytes (), Base64.DEFAULT); ImageView Image = (ImageView) this.findViewById (R.id.ImageView); Image.setImageBitmap (BitmapFactory.decodeByteArray (imageAsBytes, 0, imageAsBytes.length));  

For base 64 decoding, you can use because Android does not have base 64-support before 2.2 in.

Note, I did not actually run this code, so you have to check for errors twice.


Comments