I am trying to decode Base64 string image to Bitmap
, but it always returns null
.
Here is my code:
public static Bitmap getBitmap(String encode) {
Bitmap bm = null;
try {
byte[] decodedString = Base64.decode(encode, Base64.DEFAULT);
bm = BitmapFactory.decodeByteArray(decodedString, 0, decodedString.length);
} catch (Exception e) {
Log.e(TAG,e.getMessage());
return bm;
}
return bm;
}