Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

import android.util.Base64;

public class Main {
    /**
     * This method converts base64 string to bitmap.
     * 
     * @param base64EncodedImage
     * @return bitmap
     */
    public static Bitmap decodeFromBase64(String base64EncodedImage) {
        try {
            byte[] b = Base64.decode(base64EncodedImage, 0);
            return BitmapFactory.decodeByteArray(b, 0, b.length);
        } catch (Exception e) {
            // TODO: handle exception
            e.printStackTrace();
            return null;
        }
    }
}