title: HttpPost response doesn't return the json object
body: <p>I'm currently working on a project which needs to send a post request and get a json object from the server. Earlier I used Get method to access the json object. It worked fine. But because of some server changes I had to move to post method. Then it doesn't return me the json object that I got earlier from the 'get' method. I tried my best to come up with a solution but couldn't. Highly appreciate if anyone can help me to get through this problem.</p>
  
  <pre><code>private AdSniperAdObjectResponse postData(String url) {
      //Bundle b = new Bundle();
      HttpClient httpClient = HttpClientFactory.getThreadSafeClient();
      //Log.d(TAG, "url: " + url);
      try {
          HttpPost httpPost = new HttpPost(url);
          httpPost.setHeader("Content-Type", "application/json");
          httpPost.setHeader("Accept", "JSON");
  
  
          List&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;(4);
          nameValuePairs.add(new BasicNameValuePair("latitude", "-33.8736"));
          nameValuePairs.add(new BasicNameValuePair("longitude", "151.207"));
          nameValuePairs.add(new BasicNameValuePair("age", "35"));
          nameValuePairs.add(new BasicNameValuePair("gender", "All"));
  
          httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
  
          HttpResponse httpResponse = httpClient.execute(httpPost);
          HttpEntity resEntity = httpResponse.getEntity();
          if (resEntity != null) {
              String resp = EntityUtils.toString(resEntity);
  </code></pre>
  
  <p>Above is the code that I use. Earlier I used HttpGet class. For HttpPost, the 'resp'variable is always null. Don't know what I did wrong.</p>