开发者

Problem to parsing pictures from JSON

HY!!

I have a webservice that returns a json object with a decodes image

Link to JSON:

JSON OBJECT

My Java Code:

String im = json.getChannelImage();
                        if (!im.equals(null))
                        {
                            byte[] decodedString = Base64Coder.decode(im);
                            Bitmap bitmap = BitmapFactory.decodeByteArray(decodedString, 0, decodedString.length); 
                            iv.setImageBitmap(bitmap);

                    }

Error:

ER开发者_开发知识库ROR/Error(285): Length of Base64 encoded input string is not a multiple of 4.

I use a libary called Base64Coder, because i want to have the api level 3

Please help


It looks like there is a carriage return and line feed at the end of the image data. Remove it and it'll probably fix your problem.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜