android http post request
<p>I am trying to continuously save sensor data from my Android app into txt file online. At the same time I want my html page read that data. However, I am getting server time-out warning for my server. In fact, I set up a setInterval("RedisplayBall()", 1000) inside my javascript which gets txt data using ajax:</p>

<pre><code>    var xmlHttp = getXMLHttp();
xmlHttp.onreadystatechange = function()
{
    if(xmlHttp.readyState == 4)
    {
        AssignResult(xmlHttp.responseText);
    }
}   
xmlHttp.open("GET", "TINBCoordinates.txt", true); 
xmlHttp.send();
</code></pre>

<p>In my Android app, I send data as:</p>

<pre><code>    private class FuncionsActivity extends 
    AsyncTask&lt;ArrayList&lt;NameValuePair&gt;, Integer, Integer &gt; {
    @Override
    protected Integer doInBackground(ArrayList&lt;NameValuePair&gt;... data) {
         // 1) Connect via HTTP. 2) Encode data. 3) Send data.
        try
        {
            HttpClient httpclient = new DefaultHttpClient();
            HttpPost httppost = new HttpPost("http://mysite/saveData.php");                          
            httppost.setEntity(new UrlEncodedFormEntity(data[0]));
                    HttpResponse response = httpclient.execute(httppost);
            Log.i("postData", response.getStatusLine().toString());
            this.onPostExecute(null);
                //Could do something better with response.
        }
        catch(Exception e)
        {
            Log.e("log_tag", "Error1:  " + e.toString());
        }
      return 0;     
      }

      protected void onProgressUpdate(Integer... item){
            Log.d("TestP", item[0] + " item has been processed");
      }

      protected void onPostExecute(Integer result){
            Log.d("TestP", "AsyncTask returned : " + result);
      }
     }
</code></pre>

<p>I also have a problem with my AsyncTask. After some time app is getting turn off.
Any idea how to fix server time-out and AsyncTask problems?
Thanks!!!!!   </p>
