Android Bitmap to String Convert convertBase64ToBitmap(String data)

Here you can find the source of convertBase64ToBitmap(String data)

Description

convert Base To Bitmap

Declaration

public static Bitmap convertBase64ToBitmap(String data)
            throws IOException 

Method Source Code

//package com.java2s;
import java.io.IOException;

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

public class Main {
    public static Bitmap convertBase64ToBitmap(String data)
            throws IOException {
        if (isEmpty(data)) {
            return null;
        }//from   www  .  j  a  va 2s.co m

        byte[] imageAsBytes = Base64.decode(data, Base64.DEFAULT);
        Bitmap bitmap = BitmapFactory.decodeByteArray(imageAsBytes, 0,
                imageAsBytes.length);
        return bitmap;
    }

    public static boolean isEmpty(String value) {
        return value == null || value.trim().equals("")
                || value.length() == 0;
    }
}

Related

  1. base64Bitmap(File file)
  2. bitmap2Base64(Bitmap bitmap, int bitmapQuality)