Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //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);
- byte[] decodedString = Base64.decode(encodedImage, Base64.DEFAULT);
- Bitmap decodedByte = BitmapFactory.decodeByteArray(decodedString, 0, decodedString.length);
- byte[] decodedString = Base64.decode(encodedImage, Base64.URL_SAFE);
- Bitmap decodedByte = BitmapFactory.decodeByteArray(decodedString, 0, decodedString.length);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement