Help Me, please ! I'm pretty new on Android, but I've been struggeling with this code 10 hours now, and needs help. I am trying to read the data from a web site, (in string format). The problem is that, after executed the row "response = client.execute(request);" it jumps directly to "}finally{" WHY????
My code is attached below (and i have made INTERNET permission in the maifest file). _______________________________________________________________ package com.example.helloandroid; import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.URI; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.DefaultHttpClient; public class GetMethodEx { public String getInternetData() throws Exception{ BufferedReader In = null; String data = null; try { HttpClient client = new DefaultHttpClient(); URI website = new URI("http://www.rl.se"); HttpGet request = new HttpGet(); request.setURI(website); HttpResponse response = null; response = client.execute(request); In = new BufferedReader(new InputStreamReader(response.getEntity().getContent())); StringBuffer sb = new StringBuffer(""); String l = ""; String nl = System.getProperty("line.separator"); while((l = In.readLine()) !=null){ sb.append(l + nl); } In.close(); data = sb.toString(); return data; }finally{ if(In != null){ try{ In.close(); return data; }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