I am trying to load images from url and I can display some of them in an Imageview.My problem is that I am getting
09-04 10:18:25.739: W/System.err(913): java.io.IOException: Expected a hex chunk size, but was
while decoding some images and can't display the same.
This is my code
public class downloadTask extends AsyncTask {
@Override
protected Void doInBackground(Void... params) {
// TODO Auto-generated method stub
URL link = null;
for(int i = 0; i < 5; i++)
{
try {
link = new URL(url_Link[i]);
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
//bm[i] = BitmapFactory.decodeStream((InputStream) link.getContent());
bm[i] = BitmapFactory.decodeStream(link.openConnection().getInputStream());
} catch (IOException e) {
// TODO Auto-generated catch block
System.out.println("entered"+e);
e.printStackTrace();
}
publishProgress(i);
}
return null;
}
@Override
protected void onProgressUpdate(Integer... values) {
// TODO Auto-generated method stub
iv[values[0]].setImageBitmap(bm[values[0]]);
super.onProgressUpdate(values);
}
}
What is wrong in this?
Anyone help please..Thanx in advance