Example usage for android.graphics BitmapFactory decodeByteArray

List of usage examples for android.graphics BitmapFactory decodeByteArray

Introduction

In this page you can find the example usage for android.graphics BitmapFactory decodeByteArray.

Prototype

public static Bitmap decodeByteArray(byte[] data, int offset, int length) 

Source Link

Document

Decode an immutable bitmap from the specified byte array.

Usage

From source file:Main.java

/**
 * Byte2BitMap/*from  ww  w . j a v a  2s . c  o  m*/
 *
 * @param temp
 * @return
 */
public static Bitmap getBitmapFromByte(byte[] temp) {
    if (temp != null) {
        Bitmap bitmap = BitmapFactory.decodeByteArray(temp, 0, temp.length);
        return bitmap;
    } else {
        return null;
    }
}

From source file:Main.java

/**
 * byte[] to bitmap// ww w. j  ava  2  s.  co  m
 * @param data
 * @return
 */
public static Bitmap bytes2Bitmap(byte[] data) {
    if (data != null && data.length > 0) {
        return BitmapFactory.decodeByteArray(data, 0, data.length);
    }
    return null;
}

From source file:Main.java

public static Bitmap getBitmapFromStream(String stream) throws OutOfMemoryError {
    byte[] data = Base64.decode(stream, Base64.DEFAULT);
    Bitmap bitmap = BitmapFactory.decodeByteArray(data, 0, data.length);
    return bitmap;
}

From source file:Main.java

public static Bitmap getImage(byte[] image) {
    if (image == null || image.length == 0) {
        return null;
    }//from  w w w  .  j  a  v  a  2 s  . c o  m
    return BitmapFactory.decodeByteArray(image, 0, image.length);
}

From source file:Main.java

/**
 * This method converts a byte array to a bitmap image.
 *
 * @param byteArray/*from   w w w  .j  av a 2s  . c  o  m*/
 * @return
 */
public static Bitmap getBitmapFromBytes(byte[] byteArray) {
    return BitmapFactory.decodeByteArray(byteArray, 0, byteArray.length);

}

From source file:Main.java

public static Bitmap decodeToBitmap(String encoded) {
    byte[] bytes = Base64.decode(encoded, Base64.DEFAULT);
    return BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
}

From source file:Main.java

/**
 * @param s/*from   w ww  . j  av a  2s  .co m*/
 * @return
 */
public static Bitmap base642bitmap(String s) {
    byte[] bytes = Base64.decode(s, Base64.DEFAULT);
    return BitmapFactory.decodeByteArray(bytes, 0, bytes.length);

}

From source file:Main.java

/**
 * Converts bitmap from byte array/*from   w  w w .  j  a  v a 2s . c  om*/
 *
 * @param image
 * @return
 */
public static Bitmap getImage(byte[] image) {
    return BitmapFactory.decodeByteArray(image, 0, image.length);
}

From source file:Main.java

public static Bitmap string2Bitmap(String imageData) {
    Bitmap bitmap = null;/*from ww w  . j av a 2s. com*/
    byte[] decode = Base64.decode(imageData, Base64.DEFAULT);
    bitmap = BitmapFactory.decodeByteArray(decode, 0, decode.length);
    return bitmap;
}

From source file:Main.java

public final static Bitmap stringToBitmap(String in) {
    if (in == "")
        return null;
    byte[] bytes = Base64.decode(in, Base64.DEFAULT);
    return BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
}