Example usage for android.util Base64 decode

List of usage examples for android.util Base64 decode

Introduction

In this page you can find the example usage for android.util Base64 decode.

Prototype

public static byte[] decode(byte[] input, int flags) 

Source Link

Document

Decode the Base64-encoded data in input and return the data in a new byte array.

Usage

From source file:Main.java

public static String decode(String decodecon) {
    if (TextUtils.isEmpty(decodecon)) {
        return "";
    }//www  .j a  v  a 2s  .  c  o m
    return new String(Base64.decode(decodecon, Base64.DEFAULT));

}

From source file:Main.java

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

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

public static String base64Decode(String originalString) {
    if (isEmpty(originalString))
        return "";
    return new String(Base64.decode(originalString, 0));
}

From source file:Main.java

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

From source file:Main.java

public static String decode(String data) throws UnsupportedEncodingException {
    byte[] b = Base64.decode(data.getBytes(ENCODING), Base64.DEFAULT);
    return new String(b, ENCODING);
}

From source file:Main.java

/**
 * @param s//from w w  w  .ja v  a  2 s  . 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

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);
}

From source file:Main.java

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

From source file:Main.java

static public byte[] decodeToByte(String code) {
    if (code == null || code.length() == 0) {
        return null;
    }/*from   w w  w.  ja  v  a 2 s. co  m*/
    return Base64.decode(code.getBytes(), Base64.NO_WRAP);
}