title: fatal exception : asynctask #1 doInBackground
body: <p>Im new to android programming and i cant pinpoint which triggers the error. i am having this errors:</p>
  
  <pre><code>10-29 02:34:17.989: E/AndroidRuntime(853): FATAL EXCEPTION: AsyncTask #1
  10-29 02:34:17.989: E/AndroidRuntime(853): java.lang.RuntimeException: An error occured while executing doInBackground()
  10-29 02:34:17.989: E/AndroidRuntime(853):  at android.os.AsyncTask$3.done(AsyncTask.java:299)
  10-29 02:34:17.989: E/AndroidRuntime(853):  at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352)
  10-29 02:34:17.989: E/AndroidRuntime(853):  at java.util.concurrent.FutureTask.setException(FutureTask.java:219)
  10-29 02:34:17.989: E/AndroidRuntime(853):  at java.util.concurrent.FutureTask.run(FutureTask.java:239)
  10-29 02:34:17.989: E/AndroidRuntime(853):  at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
  10-29 02:34:17.989: E/AndroidRuntime(853):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
  10-29 02:34:17.989: E/AndroidRuntime(853):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
  10-29 02:34:17.989: E/AndroidRuntime(853):  at java.lang.Thread.run(Thread.java:841)
  10-29 02:34:17.989: E/AndroidRuntime(853): Caused by: java.lang.NullPointerException
  10-29 02:34:17.989: E/AndroidRuntime(853):  at com.agf.tripassigner.CreateTripActivity$CreateTrip.doInBackground(CreateTripActivity.java:104)
  10-29 02:34:17.989: E/AndroidRuntime(853):  at com.agf.tripassigner.CreateTripActivity$CreateTrip.doInBackground(CreateTripActivity.java:1)
  10-29 02:34:17.989: E/AndroidRuntime(853):  at android.os.AsyncTask$2.call(AsyncTask.java:287)
  10-29 02:34:17.989: E/AndroidRuntime(853):  at java.util.concurrent.FutureTask.run(FutureTask.java:234)
  10-29 02:34:17.989: E/AndroidRuntime(853):  ... 4 more
  10-29 02:34:18.848: W/EGL_emulation(853): eglSurfaceAttrib not implemented
  10-29 02:34:19.909: E/WindowManager(853): Activity com.agf.tripassigner.CreateTripActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{41844d20 V.E..... R......D 0,0-456,144} that was originally added here
  10-29 02:34:19.909: E/WindowManager(853): android.view.WindowLeaked: Activity com.agf.tripassigner.CreateTripActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{41844d20 V.E..... R......D 0,0-456,144} that was originally added here
  10-29 02:34:19.909: E/WindowManager(853):   at android.view.ViewRootImpl.&lt;init&gt;(ViewRootImpl.java:345)
  10-29 02:34:19.909: E/WindowManager(853):   at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:239)
  10-29 02:34:19.909: E/WindowManager(853):   at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
  10-29 02:34:19.909: E/WindowManager(853):   at android.app.Dialog.show(Dialog.java:281)
  10-29 02:34:19.909: E/WindowManager(853):   at com.agf.tripassigner.CreateTripActivity$CreateTrip.onPreExecute(CreateTripActivity.java:80)
  10-29 02:34:19.909: E/WindowManager(853):   at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:586)
  10-29 02:34:19.909: E/WindowManager(853):   at android.os.AsyncTask.execute(AsyncTask.java:534)
  10-29 02:34:19.909: E/WindowManager(853):   at com.agf.tripassigner.CreateTripActivity$1.onClick(CreateTripActivity.java:58)
  10-29 02:34:19.909: E/WindowManager(853):   at android.view.View.performClick(View.java:4240)
  10-29 02:34:19.909: E/WindowManager(853):   at android.view.View$PerformClick.run(View.java:17721)
  10-29 02:34:19.909: E/WindowManager(853):   at android.os.Handler.handleCallback(Handler.java:730)
  10-29 02:34:19.909: E/WindowManager(853):   at android.os.Handler.dispatchMessage(Handler.java:92)
  10-29 02:34:19.909: E/WindowManager(853):   at android.os.Looper.loop(Looper.java:137)
  10-29 02:34:19.909: E/WindowManager(853):   at android.app.ActivityThread.main(ActivityThread.java:5103)
  10-29 02:34:19.909: E/WindowManager(853):   at java.lang.reflect.Method.invokeNative(Native Method)
  10-29 02:34:19.909: E/WindowManager(853):   at java.lang.reflect.Method.invoke(Method.java:525)
  10-29 02:34:19.909: E/WindowManager(853):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
  10-29 02:34:19.909: E/WindowManager(853):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
  10-29 02:34:19.909: E/WindowManager(853):   at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>and these are my  codes in the class asynctask:</p>
  
  <pre><code>class CreateTrip extends AsyncTask&lt;String, String, String&gt; {
          /**
           * Before Sttarting Background thread Show Progress Dialog
           */
          @Override
          protected void onPreExecute() {
              super.onPreExecute();
              pDialog = new ProgressDialog(CreateTripActivity.this);
              pDialog.setMessage("Creating Trip...");
              pDialog.setIndeterminate(false);
              pDialog.setCancelable(true);
              pDialog.show();
  
          }
          /**
           * Creating Trip
           */
          protected String doInBackground(String... args) {
              String plate = inputPlate.getText().toString();
              String customer = inputCustomer.getText().toString();
              String area = inputArea.getText().toString();
              String driver = inputDriver.getText().toString();
  
              //Building parameters
              List&lt;NameValuePair&gt; params = new ArrayList&lt;NameValuePair&gt;();
              params.add(new BasicNameValuePair("plate", plate));
              params.add(new BasicNameValuePair("customer", customer));
              params.add(new BasicNameValuePair("area", area));
              params.add(new BasicNameValuePair("driver", driver));
  
              //getting JSON Object
              // Note that create trip url accepts post method
              JSONObject json = jsonParser.makeHttpRequest(url_create_trip, "POST", params);
  
              // check log cat for response
              Log.d("Create Response", json.toString());
  
              // check for success tag
              try{
                  int success = json.getInt(TAG_SUCCESS);
  
                  if (success == 1){
                      //successfully created trip 
                      Intent i = new Intent(getApplicationContext(), CreateTripActivity.class);
                      startActivity(i);
  
                      //closing this screen
                      finish();
  
                  }else {
                      // failed to create trip
                  }
              } catch (JSONException e){
                  e.printStackTrace();
              }
              return null;
          }
          /**
           * After Completing background task Dismiss the progress Dialog
           */
          protected void onPostExecute(String file_url) {
              // dismiss the dialog once done
              pDialog.dismiss();
  
          }
      }
  }
  </code></pre>
  
  <p>please help :((</p>