title: Android HTTP GET error
body: <p>Sorry I'm new in the world java and android.
  I would like to understand why it always responds error.
  Thank you!</p>
  
  <pre><code>try {
              HttpClient client = new DefaultHttpClient();  
              String getURL = "http://www.google.com";
              HttpGet get = new HttpGet(getURL);
              HttpResponse responseGet = client.execute(get);  
              HttpEntity resEntityGet = responseGet.getEntity();  
              if (resEntityGet != null) {  
              Toast.makeText(getApplicationContext(), "ok", Toast.LENGTH_LONG).show();
               }
      } catch (Exception e) {
          //e.printStackTrace();
          Toast.makeText(getApplicationContext(), "error", Toast.LENGTH_LONG).show();
      }
  </code></pre>
  
  <p>Import</p>
  
  <pre><code>import org.apache.http.HttpEntity;
  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;
  </code></pre>
  
  <p>and yes and I entered permission internet</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.example.testhttp"
      android:versionCode="1"
      android:versionName="1.0" &gt;
  
          &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
  
      &lt;uses-sdk
          android:minSdkVersion="8"
          android:targetSdkVersion="17" /&gt;
  </code></pre>