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;

public class Main {
    /**
     * Generate a bitmap from a byte array
     * @param imageInBytes the image in a byte array
     * @return the image as a bitmap
     */
    public static Bitmap saveImageFromBytes(byte[] imageInBytes) {
        if (imageInBytes == null) {
            return null;
        }
        return BitmapFactory.decodeByteArray(imageInBytes, 0, imageInBytes.length);
    }
}