I have written a method, like this
private Bitmap getBitmapFromUrl(String urlString)
{
  try  {
    URL url = new URL(urlString);
    HttpURLConnection con = (HttpURLConnection)url.openConnection();
    InputStream is = con.getInputStream();
    Bitmap bmp = BitmapFactory.decodeStream(is);
    return bmp;
  }catch(Exception e)
  {
    return null;
  }
};

When I call this method continuously in a thread, it returns a valid
bitmap only at the first call, as for the following call, LogCat would
report "jpeg error 20 Improper call to JPEG library in state".

Actually, I think the problem is because of the connection error,
since when I debug the application, the inputstream seems invalid.

Is there anyone know what the problem is it?
Thanks in advance.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to