views:

57

answers:

1

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.

A: 

What carrier is that? I remember that T-Mobile always routed http traffic through their own proxy which is a bit slow to refresh, and there were some issues, particularly when the data was under a certain size - 64KB, I believe.

See this thread: http://groups.google.com/group/android-developers/browse_frm/thread/48e84811764da1cb/7f052a903314b2b4?hl=en

EboMike
Interesting... I'm on Verizon, but I'm hoping to get a friend on Sprint to try it out and possibly one on T-Mobile (I can't remember for sure which carrier he has now).
Computerish
You could also try to fool the proxy by adding some dummy data to your Url, like "?randomvalue=12345678" - see if that makes a difference.
EboMike
Thanks, but it didn't make a difference. I finally just added a line at the end of the image downloading function that says `if(image==null) return downloadImage(url, retryCount-1);'
Computerish