title: Trouble sending JSON Post Android
body: <p>It has been a while since I programmed for Android and I have lost all my previous work which had the code in it I am having problems with. I am developing an app for both Android and iPhone which connect to the same server to download data. All is well in the iPhone version but on Android when I hit the server with the post data containing the method name I would like to to run on the server it seems that the data is not added to the request. </p>
  
  <p>Why is the POST not working in this request for Android but does for the iPhone version of the app?</p>
  
  <p>Here is the code I am using:</p>
  
  <pre><code>public static void makeRequest() throws Exception {
      Thread t = new Thread() {
          public void run() {
              Looper.prepare(); //For Preparing Message Pool for the child Thread
              HttpClient client = new DefaultHttpClient();
              HttpConnectionParams.setConnectionTimeout(client.getParams(), 10000);
              HttpResponse response;
              HttpEntity entity;
              JSONObject json = new JSONObject();
  
              try {
                  HttpPost post = new HttpPost("http://divisi.co.uk/rest/requesthandler.php");
                  json.put("method", "getEventListData");
  
                  StringEntity se = new StringEntity(json.toString());  
                  se.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json"));
                  post.setEntity(se);
  
                  response = client.execute(post);
  
                  entity = response.getEntity();
  
                  String retSrc = EntityUtils.toString(entity); 
  
                  JSONObject result = new JSONObject(retSrc); //Convert String to JSON Object
                  if(result.getString("SC") == "200"){
                      JSONArray data = result.getJSONArray("data");
                  }
                  else{
  
                  }
  
              } catch(Exception e) {
                  e.printStackTrace();
              }
  
              Looper.loop(); //Loop in the message queue
          }
      };
      t.start();
  }
  </code></pre>
  
  <p>The response I get mack from the server is:</p>
  
  <pre><code>{"data":{"scalar":""},"SC":405,"timestamp":1363788265}
  </code></pre>
  
  <p>Meaning the method name was not found, i.e. not posted in my request to the server.</p>