Hello, I'm trying to connect to the internet and retrieve the xml of a website. At the moment I'm just trying to connect to the google main page, because there shouldn't be any connection problems there. I've discovered that the program hangs at the HttpResponse line and just can't get past it, and I can't seem to find a way around it. In addition, I know I'm getting an exception thrown, but I can't find out what exception. Can anyone tell me how I can find the exception (doesn't appear in the debug screen or in the textview), or what I need to change to get HttpResponse to work?
InputStream content = null; try{ HttpClient httpClient = new DefaultHttpClient(); > HttpContext localContext = new BasicHttpContext(); > HttpGet httpGet = new HttpGet("http://www.google.com.au"); > HttpResponse response = httpClient.execute(httpGet, localContext); > content = response.getEntity().getContent(); > } catch (Exception e) { > TextView Text = (TextView) findViewById(R.id.TextView02); > Text.setText(e); } /** String result = ""; > BufferedReader reader = new BufferedReader(new > InputStreamReader(response.getEntity().getContent() > )); > > BufferedReader rd = new BufferedReader(new InputStreamReader(content), > 4096); > > String line = null; > > StringBuilder sb = new StringBuilder(); > > while ((line = reader.readLine()) != null){ > result += line + "\n"; > } > rd.close(); > String streamcontent = sb.toString(); > TextView Text = (TextView) findViewById(R.id.TextView02); > Text.setText(streamcontent); > } catch (Exception e) { > e.printStackTrace(); > } -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en