Primarily. Convert the bitmap to ByteArray, and then convert this byte array to the Base64 String format and send this Base64 String format to xml.
ByteArrayOutputStream baos = new ByteArrayOutputStream(); bmp.compress(CompressFormat.PNG, 0 , baos);
Now send the encodedImage
to your xml ...
Convert Base64 to bitmap
public static Bitmap convertByteArrayToBitmap(String Base64String) { byte[] data = Base64.decode(Base64String, Base64.DEFAULT); Bitmap bitmap = BitmapFactory.decodeByteArray(data , 0, data.length); return bitmap; }
source share