title: thread exiting with uncaught exception (group=0x41736e30)
body: <pre><code>public class CreateEventTask extends AsyncTask&lt;Void, Void, Void&gt; {
      com.google.api.services.calendar.Calendar mService;
      java.util.Calendar calendar, calendar1;
      String EventTitle;
      String useremail;
      String location;
  
  CreateEventTask(Calendar mService, String EvTitle, java.util.Calendar cal, java.util.Calendar cal1, String Uemail, String loc) {
          this.mService = mService;
          EventTitle = EvTitle;
          calendar = cal;
          calendar1 = cal1;
          useremail = Uemail;
          location = loc;
      }
  
  @Override
  protected Void doInBackground(Void... params) {
      addCalendarEvent();
      return null;
  }
  
    public void addCalendarEvent() {
          Event event = new Event()
                  .setSummary(EventTitle)
                  .setLocation(location)
                  .setDescription("My efforts.");
  
          DateTime startDateTime = new DateTime(calendar.getTime());
          EventDateTime start = new EventDateTime().setDateTime(startDateTime);
          event.setStart(start);
  
          DateTime endDateTime = new DateTime(calendar1.getTime());
          EventDateTime end = new EventDateTime().setDateTime(endDateTime);
  
          event.setEnd(end);
          Log.d("Event stored", event.getEnd().getDateTime().toString());
          String calendarId = "primary";
          try {
              mService.events().insert(calendarId, event).execute();
          } catch (IOException e) {
              e.printStackTrace();
          }
  </code></pre>
  
  <p>My this code creates event one day event without any error but
  if for example an event exist on 4 march 2016 
    While creating event start date 3 march 2016 to 5 march 2016 
  it gives following exception please help </p>
  
  <pre><code>  02-21 00:31:54.534  14067-14187/com.example.meetingplanner W/dalvikvm﹕ threadid=13: thread exiting with uncaught exception (group=0x41736e30)
          02-21 00:31:54.544  14067-14187/com.example.meetingplanner E/AndroidRuntime﹕ FATAL EXCEPTION: AsyncTask #2
              Process: com.example.meetingplanner, PID: 14067
              java.lang.RuntimeException: An error occured while executing doInBackground()
                      at android.os.AsyncTask$3.done(AsyncTask.java:300)
                      at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
                      at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
                      at java.util.concurrent.FutureTask.run(FutureTask.java:242)
                      at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
                      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
                      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
                      at java.lang.Thread.run(Thread.java:864)
               Caused by: java.lang.NullPointerException
                      at com.example.meetingplanner.CreateEventTask.addCalendarEvent(CreateEventTask.java:52)
                      at com.example.meetingplanner.CreateEventTask.doInBackground(CreateEventTask.java:31)
                      at com.example.meetingplanner.CreateEventTask.doInBackground(CreateEventTask.java:13)
                      at android.os.AsyncTask$2.call(AsyncTask.java:288)
                      at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                      at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
                      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
                      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
                      at java.lang.Thread.run(Thread.java:864)
  </code></pre>