开发者

how to convert imagebytes to byte[] in android using ksoap?

开发者 https://www.devze.com 2023-02-26 05:30 出处:网络
friends, i am using ksoap library to call dotnet w开发者_开发知识库ebservice. i am getting following webservice reponse

friends,

i am using ksoap library to call dotnet w开发者_开发知识库ebservice.

i am getting following webservice reponse

     <imageByte>R0lGODlhlgBQAPcAAKPBqfP69Ja0m32hgxdVJdrb28zMzPr+/QRKEdPi1IGliL3PwCFXLP38+YSJhPr7+</imageByte>
<imageByte>R0lGODlhlgBQAPcAAKPBqfP69Ja0m32hgxdVJdrb28zMzPr+/QRKEdPi1IGliL3PwCFXLP38+YSJhPr7+</imageByte>
<imageByte>R0lGODlhlgBQAPcAAKPBqfP69Ja0m32hgxdVJdrb28zMzPr+/QRKEdPi1IGliL3PwCFXLP38+YSJhPr7+</imageByte>

removed some extra bytes from string because it was very lengthy.

1) i dont know which format it is. 2) how to convert it to byte[] to display it in android imageview.

any help would be appreciated.


This may be base64 encoding; at least it looks like the right mix of characters. The specific webservice docs should tell you more about the message format.

Assuming it is, and that one image is broken into multiple <imageByte /> tags, combine the contents into one long string. You can then use Base64.decode to get a byte[], and BitmapFactory.decodeByteArray to get a Bitmap handle, which you pass to ImageView.setImageBitmap

Hope this helps,

Phil Lello

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号