Check for the status of the network before making the call, and also set a connection timeout in case it drops after/during:
http://stuffthathappens.com/blog/2007/09/10/urlopenstream-might-leave-you-hanging/ You might want to look at the Apache HttpClient stuff Android comes with too, you have a much more robust library there that can handle all kinds of things, as opposed to raw URL class and streams. Here is an example of using the HttpClient stuff: http://code.google.com/p/and-bookworm/source/browse/trunk/src/com/totsp/bookworm/data/HttpHelper.java On Jul 7, 2:54 pm, Boozel <[email protected]> wrote: > I'm trying to get an HTTP response using > BufferedReader in = new BufferedReader(new > InputStreamReader(url.openStream())); > but if no internet connection is present the app hangs here. > Can any one give me a way to prevent this? > Thanks -- 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

