I think the problem is that you are trying to decode a base64 string to Bitmap, but actually you just want to decode it to a string. Here's the code to do that:
String decodeBase64String(String encodedString)
{
byte[] data = Base64.decode(encodedString, Base64.DEFAULT);
return new String(data, "UTF-8");
}
(assumes UTF-8 encoding)
If you call this function with your test string like this:
String result = decodeBase64String("aGVsbG8=");
then result will be "hello".
Here's how to convert text to a Bitmap:
Bitmap textToBitmap(String text)
{
Paint paint = new Paint();
paint.setColor(Color.WHITE);
paint.setStrokeWidth(12);
Rect bounds = new Rect();
paint.getTextBounds(text, 0, text.length(), bounds);
Bitmap bitmap = Bitmap.createBitmap(bounds.width(), bounds.height(), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
canvas.drawText(text, 0, 0, paint);
return bitmap;
}
So you can convert your base64 encoded text to a bitmap like this:
String result = decodeBase64String("aGVsbG8=");
Bitmap bitmap = textToBitmap(result);
Or you could just do this:
Bitmap bitmap = textToBitmap("hello");