Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import android.graphics.Bitmap;

import android.graphics.BitmapFactory;

import android.graphics.drawable.BitmapDrawable;

public class Main {
    /**
     * byte[] -> Drawable
     * 
     * @param bytes
     * @return
     */
    public static BitmapDrawable byteToDrawable(byte[] bytes) {
        Bitmap bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.length, null);
        BitmapDrawable bd = new BitmapDrawable(bitmap);
        bitmap.recycle();
        bitmap = null;
        return bd;
    }
}