Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/**
 * Android system utilities: Copy a file
 * 
 * @copyright   Copyright (C) 2012 - 2013 Information Technology Institute ITI-CERTH. All rights reserved.
 * @license     GNU Affero General Public License version 3 or later; see LICENSE.txt
 * @author      Dimitrios Ververidis for the Multimedia Group (http://mklab.iti.gr). 
 *
 */

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

public class Main {
    /**
     * Decode a byte array to a Bitmap with a process requiring a low amount of memory
     * @param bt image as bytes
     * @return image as bitmap
     */
    public static Bitmap LowMemBitmapDecoder(byte[] bt) {
        Bitmap bm = null;

        BitmapFactory.Options options = new BitmapFactory.Options();
        options.inPreferredConfig = Bitmap.Config.RGB_565;
        options.inPurgeable = true;
        options.inInputShareable = true;
        options.inJustDecodeBounds = false;
        bm = BitmapFactory.decodeByteArray(bt, 0, bt.length, options);

        return bm;
    }
}