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 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 byte[] Base64Decode(String data) {
    byte[] ret = null;
    if (data != null && data.length() > 0) {
        ret = Base64.decode(data, Base64.NO_WRAP);
    }/*from ww  w.  ja  v  a 2 s . co  m*/
    return ret;
}

From source file:Main.java

public static byte[] decodeUrlSafe(String encodedData) {
    if (encodedData == null) {
        return null;
    }//from w  ww.java2 s.c o m
    return Base64.decode(encodedData, 10);
}

From source file:Main.java

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

From source file:Main.java

public static String decodeToString(String encodedString) {
    try {/*  ww  w.jav  a2  s.c o  m*/
        return new String(Base64.decode(encodedString, Base64.NO_WRAP));
    } catch (Exception e) {
        e.printStackTrace();
    }
    return "";
}

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 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 base64ToBitmap(String base64Data) {
    byte[] bytes = Base64.decode(base64Data, Base64.DEFAULT);
    return BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
}

From source file:Main.java

public static Bitmap getImageAsBitmap(String image) {
    byte[] imageAsBytes = Base64.decode(image, Base64.DEFAULT);
    Bitmap bmp = BitmapFactory.decodeByteArray(imageAsBytes, 0, imageAsBytes.length);
    return bmp;//from w w w . ja v a2 s .  c  o  m
}

From source file:Main.java

public static Bitmap base64ToBitmap(String base64Data) {
    byte[] bytes = Base64.decode(base64Data.replaceFirst("data:image/jpeg;base64,", "").trim(), Base64.DEFAULT);
    return BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
}