0

In my application, I am using a web-service which returns an image in base64Binary format. I am using ksoap2 to interact with the web-services.

Can anyone provide me any help regarding how to receive the base64Binary and then convert it into an image ?

This is the code I use interact with the web-service.

SoapObject request = new SoapObject(NAMESPACE, METHOD_GET_CONTROL);
SoapSerializationEnvelope envelope = 
    new SoapSerializationEnvelope(SoapEnvelope.VER11); 
envelope.dotNet = true;
envelope.setOutputSoapObject(request);


HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);

 try {
         androidHttpTransport.call(SOAP_ACTION_GET_CONTROL, envelope);
        ..........=envelope.getResponse(); //To get the data. }

How do I receive the data in base64Binary format and then convert it into a png image ?

1

1 Answer 1

0

As suggested by @MdAbdulGafur, the following answer worked for me :

decodedIcon[] = null;
byte[] bb = (resposeString).getBytes("utf-8");
decodedIcon = Base64.decodeBase64(bb);

Bitmap bitmap = BitmapFactory.decodeByteArray(decodedIcon, 0, decodedIcon.length);

mImageView.setImageBitmap(bitmap);

Source : This question.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.