Decode base64 string to Bitmap - Android android.graphics

Android examples for android.graphics:Bitmap Create

Description

Decode base64 string to Bitmap

Demo Code

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.util.Base64;

public class Main {

  public static Bitmap toBitmap(String base64String) {
    byte[] decodedString = Base64.decode(base64String, Base64.DEFAULT);
    Bitmap decodedByte = BitmapFactory.decodeByteArray(decodedString, 0, decodedString.length);
    return decodedByte;
  }/*from w  ww.  j  ava 2  s .  c o m*/

}

Related Tutorials