title: viewing web file in textview
body: <p>i want the html file(any file on web)in my textview using httpClient class. but  it shows only initial value i set in android:text. i can't get the desired output.....</p>
  
  <p>Help me... </p>
  
  <p>Here is the code ...</p>
  
  <p>## activity_mail.xml ##</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:orientation="vertical" &gt;
  </code></pre>
  
  <p></p>
  
  <pre><code>&lt;TextView
      android:id="@+id/inData"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:text="Loading..." /&gt;
  </code></pre>
  
  <p>
  </p>
  
  <hr>
  
  <p>MainActicity.java</p>
  
  <pre><code>    package com.vivek.jsonpractice;
  
  import android.os.Bundle;
  import android.app.Activity;
  
  import android.widget.TextView;
  
  public class MainActivity extends Activity {
      TextView stuff;
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          stuff= (TextView)findViewById(R.id.inData);
          GetMethodEx test = new GetMethodEx();
          String returned;
          try {
              returned = test.getData();
              stuff.setText(returned);
          } catch (Exception e) {
              e.printStackTrace();
          }
  
      }
  
  }
  </code></pre>
  
  <hr>
  
  <p>GetMethodEx.java</p>
  
  <pre><code>    package com.vivek.jsonpractice;
  
  import java.io.BufferedReader;
  import java.io.IOException;
  import java.io.InputStreamReader;
  import java.net.URI;
  import java.net.URISyntaxException;
  
  import org.apache.http.HttpResponse;
  import org.apache.http.client.ClientProtocolException;
  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 getData() throws URISyntaxException, ClientProtocolException, IOException{
          BufferedReader in = null;
          String data = null;
          try{
              HttpClient client = new DefaultHttpClient();
              URI website = new URI("https://www.google.co.in/");
              HttpGet request = new HttpGet();
              request.setURI(website);
              HttpResponse 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();
                  }
              }
          }
      }
      }
  </code></pre>