title: HttpClient.execute(HttpPost) on Android 4.2 error
body: <p>I am following this website <a href="http://givemepass.blogspot.hk/2011/12/http-server.html" rel="nofollow">http://givemepass.blogspot.hk/2011/12/http-server.html</a> to try to use the android application connect the PHP server to get message. </p>
  
  <p>GetServerMessage.java</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.HttpPost;
  import org.apache.http.impl.client.DefaultHttpClient;
  import org.apache.http.util.EntityUtils;
  public class GetServerMessage {
  
      public String stringQuery(String url){
          try
          {
              HttpClient httpclient = new DefaultHttpClient();
              HttpPost method = new HttpPost(url);
              HttpResponse response = httpclient.execute(method);
              HttpEntity entity = response.getEntity();
              if(entity != null){
                  return EntityUtils.toString(entity);
              }
              else{
                  return "No string.";
              }
           }
           catch(Exception e){
               return "Network problem";
           }
      }
  }
  </code></pre>
  
  <p>GetPhpServerMessageDemoActivity.java</p>
  
  <pre><code>import android.app.Activity;
  import android.os.Bundle;
  import android.widget.TextView;
  
  public class GetPhpServerMessageDemoActivity extends Activity {
      /** Called when the activity is first created. */
      private TextView textView;
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
          textView = (TextView)findViewById(R.id.text_view);
          GetServerMessage message = new GetServerMessage();
          String msg = message.stringQuery("http://192.168.1.88/androidtesting.php");
          textView.setText("Server message is "+msg);
      }
  
  }
  </code></pre>
  
  <p>I tried to download the Android Application Project from that site <a href="http://uploadingit.com/file/d4632ekfpwjiupyn/GetPhpServerMessageDemo2.zip" rel="nofollow">http://uploadingit.com/file/d4632ekfpwjiupyn/GetPhpServerMessageDemo2.zip</a> and run on my phone, it's work.
  But when I start a new project (Minimuim Requied SDK: API8, Target SDK: API17, Compile with: API17) and copy these two java codes. I've added the permission <code>android.permission.INTERNET</code>, so I don't know where is the problem, I only know that when run <code>HttpResponse response = httpclient.execute(method);</code> there is a error and returned String "Network problem".</p>