0

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

1 Answer 1

1

I think this and this example will help you more than i can explain:) [code is the best documentation :P]

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.