Send data to server use service on android
<p>I want send data from android to server, here, i use a service call senddata AsyncTask.But my app is error.Can you help me!!
source service</p>

<pre><code>public class GpsService extends Service  {
HttpClient httpclient;
HttpPost httppost;
List&lt;NameValuePair&gt; nameValuePairs;
@Override
public void onCreate() {
    // TODO Auto-generated method stub
    super.onCreate();
    Toast.makeText(this, "Hello, Service dang chuan bi start!",  Toast.LENGTH_SHORT).show();
}
public void onDestroy() {
    // TODO Auto-generated method stub
    super.onDestroy();
    Toast.makeText(this, "Hello, Service dang chuan bi stop!",  Toast.LENGTH_SHORT).show();
}
@Override
public void onStart(Intent intent, int startId) {
    // TODO Auto-generated method stub
    //super.onStart(intent, startId);
    //doTimerTask();
    // Location initiation
    new senddata().execute();

}


public class senddata extends AsyncTask&lt;Void, Void, Void&gt; {
    private ProgressDialog progressdialog;

    @Override
    protected Void doInBackground(Void... params) {

        try {
            Calendar cal=Calendar.getInstance();
            int date=cal.get(Calendar.DAY_OF_MONTH);
            int month=cal.get(Calendar.MONTH)+1;
            int year=cal.get(Calendar.YEAR);
            int hour=cal.get(Calendar.HOUR_OF_DAY);
            int min=cal.get(Calendar.MINUTE);
            String str1=hour+":"+min+" "+date+"/"+month+"/"+year;
            httpclient = new DefaultHttpClient();
            httppost = new HttpPost("http://longvansolution.tk/gps.php");
            // add your data
            nameValuePairs = new ArrayList&lt;NameValuePair&gt;(3);
            nameValuePairs.add(new BasicNameValuePair("la", "test1"));
            nameValuePairs.add(new BasicNameValuePair("lon", "test2"));
            nameValuePairs.add(new BasicNameValuePair("str", str1));
            HttpEntity entity = new UrlEncodedFormEntity(nameValuePairs);
            httppost.addHeader(entity.getContentType());
            httppost.setEntity(entity);
            response = httpclient.execute(httppost);

        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

    @Override
    protected void onPostExecute(final Void unused) {
        // TODO Auto-generated method stub
        this.progressdialog.dismiss();

    }

    @Override
    protected void onPreExecute() {
        // TODO Auto-generated method stub
        //this.progressdialog = ProgressDialog.show(GpsService.this, "",
        //      "Loading...");
    }

}
</code></pre>

<p>}</p>

<p>this error</p>

<blockquote>
  <p>11-16 10:57:09.905: E/AndroidRuntime(1846): FATAL EXCEPTION: main</p>
</blockquote>

<p>11-16 10:57:09.905: E/AndroidRuntime(1846): java.lang.NullPointerException</p>

<p>11-16 10:57:09.905: E/AndroidRuntime(1846): at LongVan.mapfinish.GpsService$senddata.onPostExecute(GpsService.java:153)</p>

<p>11-16 10:57:09.905: E/AndroidRuntime(1846):     at LongVan.mapfinish.GpsService$senddata.onPostExecute(GpsService.java:1)</p>

<p>11-16 10:57:09.905: E/AndroidRuntime(1846):     at android.os.AsyncTask.finish(AsyncTask.java:602)</p>

<p>11-16 10:57:09.905: E/AndroidRuntime(1846): at android.os.AsyncTask.access$600(AsyncTask.java:156)</p>

<p>11-16 10:57:09.905: E/AndroidRuntime(1846): at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:615)</p>

<p>11-16 10:57:09.905: E/AndroidRuntime(1846):     at android.os.Handler.dispatchMessage(Handler.java:99)</p>

<p>11-16 10:57:09.905: E/AndroidRuntime(1846): at android.os.Looper.loop(Looper.java:137)</p>

<p>11-16 10:57:09.905: E/AndroidRuntime(1846): at android.app.ActivityThread.main(ActivityThread.java:4514)</p>

<p>11-16 10:57:09.905: E/AndroidRuntime(1846): at java.lang.reflect.Method.invokeNative(Native Method)</p>

<p>11-16 10:57:09.905: E/AndroidRuntime(1846): at java.lang.reflect.Method.invoke(Method.java:511)</p>

<p>11-16 10:57:09.905: E/AndroidRuntime(1846): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)</p>

<p>11-16 10:57:09.905: E/AndroidRuntime(1846): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)</p>

<p>11-16 10:57:09.905: E/AndroidRuntime(1846): at dalvik.system.NativeStart.main(Native Method)</p>
