lundi 28 avril 2014

Base64 decode exception on ListView Scroll up in Android


Vote count:

1




I am trying to load a bitmap to image view from encoded String . When i scroll up the list view i am getting the following error



java.lang.IllegalArgumentException: bad base-64
at android.util.Base64.decode(Base64.java:161)
at android.util.Base64.decode(Base64.java:136)
at android.util.Base64.decode(Base64.java:118)
at com.butler.android.myAdapter.displayThumbNail(ChatAdapter.java:510)
at com.butler.android.myAdapter.getView(ChatAdapter.java:429)


and i am using the method in getView() of myAdapter extends BaseAdapter



private Bitmap displayThumbNail(String encodedImage,ViewHolder holder,boolean incoming) {
// TODO Auto-generated method stub


byte[] decodedString =null;
Bitmap decodedByte=null;
decodedString = Base64.decode(encodedImage, Base64.DEFAULT);
decodedByte = BitmapFactory.decodeByteArray(decodedString, 0, decodedString.length);






holder.iv_image_incoming.setImageBitmap(
BitmapFactory.decodeByteArray(decodedByte ,0, imageAsBytes.length)
);


return decodedByte;}


Could you please help me to resolve this bug.


Thanks in advance



asked 28 secs ago






Aucun commentaire:

Enregistrer un commentaire