Organizational Research By

Surprising Reserch Topic

how to convert a base64 string into a bitmap image to show it in a imageview


how to convert a base64 string into a bitmap image to show it in a imageview  using -'android,base64,imageview'

I have a Base64 String that represents a BitMap image.

I need to transform that String into a BitMap image again to use it on a ImageView in my Android app

How to do it?

This is the code that I use to transform the image into the base64 String:

//proceso de transformar la imagen BitMap en un String:
//android:src="c:\logo.png"
Resources r = this.getResources();
Bitmap bm = BitmapFactory.decodeResource(r, R.drawable.logo);
ByteArrayOutputStream baos = new ByteArrayOutputStream();  
bm.compress(Bitmap.CompressFormat.PNG, 100, baos); //bm is the bitmap object   
byte[] b = baos.toByteArray();
//String encodedImage = Base64.encode(b, Base64.DEFAULT);
encodedImage = Base64.encodeBytes(b);

    
asked Sep 15, 2015 by HunterDelmorec
0 votes
17 views



Related Hot Questions



Government Jobs Opening


...