title: Android | Send “POST” JSON Data to Server
body: <p>I used this code to send post data to server using android. Could anyone give me any idea or your sample how to send POST OR GET json data to server TOMCAT..!
  Steps tips :</p>
  
  <ol>
  <li>create HttpClient</li>
  <li>make POST request to the given URL</li>
  <li>build jsonObject       </li>
  <li>convert JSONObject to JSON to String</li>
  <li>set json to StringEntity</li>
  <li>set httpPost Entity</li>
  <li>Set some headers to inform server about the type of the content   </li>
  <li>Execute POST request to the given URL</li>
  <li>receive response as inputStream</li>
  <li>convert inputstream to string</li>
  <li><p>return result</p>
  
  <pre><code>private class HttpAsyncTask extends AsyncTask&lt;String, Void, String&gt; {
  
          @Override
          protected String doInBackground(String... urls) {
  
          person = new Person();
          person.setName(etName.getText().toString());
          person.setCountry(etCountry.getText().toString());
          person.setTwitter(etTwitter.getText().toString());
  
          return POST(urls[0],person);
      }
      // onPostExecute displays the results of the AsyncTask.
      @Override
      protected void onPostExecute(String result) {
          Toast.makeText(getBaseContext(), "Data Sent!", Toast.LENGTH_LONG).show();
     }
  }
  </code></pre></li>
  </ol>