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;

import java.io.ByteArrayInputStream;

public class Main {
    public static Bitmap getBitmapByString(String imgSrc) {
        if (imgSrc != null) {
            byte[] buf = Base64.decode(imgSrc, Base64.NO_WRAP);
            ByteArrayInputStream bas = new ByteArrayInputStream(buf);
            Bitmap pic = BitmapFactory.decodeStream(bas);
            return pic;
        } else
            return null;
    }
}