I am building an android app. I have a Base64 encoded string. I need two answers: - How to convert encoded string to image - How to set it as image resource for an image button
Asked
Active
Viewed 1,048 times
-1
-
That is one part of question. but I can set image resource to image button which are in drawable folder. how to set this base64 decoded image as image esource which is not in drawable folder. – Deepak Jun 15 '16 at 06:06
-
convert base64 into bitmap and set the bitmap to image view or image button – Brahmam Yamani Jun 15 '16 at 09:29
1 Answers
0
String base="****Base64 string values of some image******”;
byte[] imageAsBytes = Base64.decode(base.getBytes(), Base64.DEFAULT);
ImageButton image = (ImageButton )this.findViewById(R.id.imagebutton);
image.setImageBitmap(
BitmapFactory.decodeByteArray(imageAsBytes, 0, imageAsBytes.length)
);

Akshay Chopde
- 670
- 4
- 10