title: Can't finally perform HTTP POST request
body: <p>I work on my first Android application and I have some great problems with trying to make HTTP POST request and receive response. These are few facts:</p>
  
  <ol>
  <li>I have INTERNET permission in AndroidManifest.xml:
   <code>&lt;uses-permission android:name="android.permission.INTERNET" /&gt;</code></li>
  <li>I tried many solutions. Solutions with URLConnection or HttpURLConnection don't work because they return empty string. Solution with HttpClient and HttpPost fails on execute() - I was googling for an hour but didn't find out how to fix that.</li>
  <li>There <strong>is</strong> internet connection. But I don't know how to fix my problem and finally to <em>send HTTP POST request.</em></li>
  </ol>
  
  <p><strong>upd:</strong> e.g. this code makes my program crash:</p>
  
  <pre><code>public static APIResponse getResponse(String action, Map&lt;String, String&gt; params) throws IOException {
      // Create a new HttpClient and Post Header
      HttpClient httpclient = new DefaultHttpClient();
      HttpPost httppost = new HttpPost("http://google.com");
  
      try {
          // Add your data
          List&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;(2);
          nameValuePairs.add(new BasicNameValuePair("id", "12345"));
          httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
  
          // Execute HTTP Post Request
          HttpResponse response = httpclient.execute(httppost);
  
      } catch (ClientProtocolException e) {
          // TODO Auto-generated catch block
      } catch (IOException e) {
          // TODO Auto-generated catch block
      }
      return null;
  }
  </code></pre>
  
  <p><strong>upd 2:</strong> it works on my phone but doesn't work on emulator! how to fix that behaviour on emulator?</p>
  
  <p><strong>upd 3:</strong> fixed.</p>