I have an android application that parses some HTML, downloads an image, and displays it. I'm using an AsyncTask
to do the HTML parsing and image downloading, but that shouldn't be relevant. I never have a problem when I'm on WiFi on my phone, when I'm using the Eclipse debugger on my phone, or when I'm using the emulator. When I have my phone on the cell network (even with pretty good reception), the image sometimes fails to display.
I'm having a hard time figuring out what is wrong, since the problem cannot be reproduced in the debugger. Does anyone have any idea what could be wrong?
Thanks!
Update: I have narrowed it down to the image downloading function. This way my original code:
private Bitmap downloadImage(String url) {
Bitmap image = null;
debug = "";
try {
URL image_url = new URL(url);
HttpURLConnection image_connection = (HttpURLConnection) image_url
.openConnection();
image_connection.connect();
InputStream image_stream = image_connection.getInputStream();
debug = image_stream.available()+"";
image = BitmapFactory.decodeStream(image_stream);
} catch (Exception e) {
Log.e("downloadImage", "Exception: "+e.getMessage());
}
return image;
}
I have also tried using the code from this tutorial, but the same bug showed up.
http://www.devx.com/wireless/Article/39810/1954
At this point I think it must have to do with Verizon, but I'm not sure how to figure out what's going on. I wish there was something like Wireshark for Android. I've given my code to a friend of mine on T-Mobile with the G1 and a friend on Sprint with the EVO. I have the Droid Eris on Verizon.