onLocationChange() - cant send post request
<p>I am creating simple GPS tracker. Application gets gps latitude/longitude and sends it to php on remote server. </p>

<pre><code>@Override

public void onLocationChanged(Location loc)
{
   String infLat = Double.toString(loc.getLatitude());
   String infLon = Double.toString(loc.getLongitude());

   String Text = "My current location is: " +
     "Latitud = " + infLat +
     "Longitud = " + infLon;

   Toast.makeText( getApplicationContext(),
                   Text,
                   Toast.LENGTH_SHORT).show();

   uploadLoc(infLat, infLon); // calling method which sends location info
}
</code></pre>

<p>And here is uploadLoc:</p>

<pre><code>public void uploadLoc(String a, String b) {
    HttpClient httpclient = new DefaultHttpClient();
    HttpPost httppost = new HttpPost("http://link to script");

    try {

        List&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;(2);
        nameValuePairs.add(new BasicNameValuePair("latitude", a));
        nameValuePairs.add(new BasicNameValuePair("longitude", b));
        httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));

        // Execute HTTP Post Request
        HttpResponse response = httpclient.execute(httppost);

    } catch (ClientProtocolException e) {
        //
    } catch (IOException e) {
       //
    }
}
</code></pre>

<p>But i am constantly getting "application has stopped". When i remove line that is calling uploadLoc method, everything works and Toast is updated as location changes. What can be wrong here? </p>
