Example usage for android.util Base64 DEFAULT

List of usage examples for android.util Base64 DEFAULT

Introduction

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

Prototype

int DEFAULT

To view the source code for android.util Base64 DEFAULT.

Click Source Link

Document

Default values for encoder/decoder flags.

Usage

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   www.  ja va2  s  .c om
}

From source file:Main.java

public static String base64Encode(String str) {
    try {//w w  w . j a va 2  s.  c  o m
        str = Base64.encodeToString(str.getBytes("UTF-8"), Base64.DEFAULT);
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }
    return str;
}

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 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 void decoderBase64File(String base64Code, String savePath) throws Exception {
    byte[] buffer = Base64.decode(base64Code, Base64.DEFAULT);
    FileOutputStream out = new FileOutputStream(savePath);
    out.write(buffer);//from   ww  w .ja  v a2  s. c  o  m
    out.close();
}

From source file:Main.java

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

From source file:Main.java

public static byte[] decode(String str) {
    return Base64.decode(str, Base64.DEFAULT);
}

From source file:Main.java

public static Bitmap decodeBitmap(String imageString) {
    byte[] imageBytes = Base64.decode(imageString, Base64.DEFAULT);
    Bitmap bmp = BitmapFactory.decodeByteArray(imageBytes, 0, imageBytes.length);

    return bmp;/*from   w w w .  java2 s .  co  m*/
}

From source file:Main.java

public static Bitmap base64ToBitmap(String base64String) {
    byte[] imgBytes = Base64.decode(base64String, Base64.DEFAULT);

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

From source file:Main.java

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