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

public static Bitmap decodeBase64(String input) {
    byte[] decodedByte = Base64.decode(input, 0);
    return BitmapFactory.decodeByteArray(decodedByte, 0, decodedByte.length);
}

From source file:Main.java

public static Bitmap convertByte2Bitmap(byte[] data) {
    Bitmap bmp = null;/*from w w  w .  j av a2 s  .  co  m*/
    if (data != null && data.length > 0) {
        bmp = BitmapFactory.decodeByteArray(data, 0, data.length);
    }
    return bmp;
}

From source file:Main.java

private static Bitmap bytes2Bitmap(final byte[] bytes) {
    return (bytes == null || bytes.length <= 0) ? null : BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
}

From source file:Main.java

public static Bitmap ByteToBitmap(String strbyte) {
    byte[] bytes = Base64.decode(strbyte.getBytes(), 1);
    return BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
}

From source file:Main.java

public static Bitmap getByteArrayAsBitmap(byte[] bytesImage) {
    return BitmapFactory.decodeByteArray(bytesImage, 0, bytesImage.length);
}

From source file:Main.java

public static Bitmap getBitmapFromByte(byte[] bytes) {
    if (null == bytes || bytes.length == 0) {
        return null;
    }//from  w  ww. j  a  v  a  2  s.  c  o  m

    return BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
}

From source file:Main.java

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

From source file:Main.java

public static Bitmap Bytes2Bitmap(Intent intent) {
    byte[] buff = intent.getByteArrayExtra("bitmap");
    Bitmap bm = BitmapFactory.decodeByteArray(buff, 0, buff.length);
    return bm;/* w  w w  .j a v  a2s . c  om*/
}

From source file:Main.java

public static Bitmap bytes2Bitmap(Intent intent) {
    byte[] buff = intent.getByteArrayExtra("bitmap");
    Bitmap bm = BitmapFactory.decodeByteArray(buff, 0, buff.length);
    return bm;//from  w  w w  . j  av a 2s .  c o m
}

From source file:Main.java

public static Bitmap getRotatedBitmap(byte[] bildDaten) {
    Bitmap result = BitmapFactory.decodeByteArray(bildDaten, 0, bildDaten.length);
    if (result.getWidth() > result.getHeight()) {
        Matrix m = new Matrix();
        m.postRotate(90);//from   ww  w  .  j a va 2 s . co m
        result = Bitmap.createBitmap(result, 0, 0, result.getWidth(), result.getHeight(), m, true);
    }
    return result;
}