private void addCalendarEvent(String summary,Date start,boolean allDay,Date end,String location,String description,String[] attendees){
  Intent intent=new Intent(Intent.ACTION_INSERT);
  intent.setType("vnd.android.cursor.item/event");
  long startMilliseconds=start.getTime();
  intent.putExtra("beginTime",startMilliseconds);
  if (allDay) {
    intent.putExtra("allDay",true);
  }
  long endMilliseconds;
  if (end == null) {
    if (allDay) {
      endMilliseconds=startMilliseconds + 24 * 60 * 60* 1000;
    }
 else {
      endMilliseconds=startMilliseconds;
    }
  }
 else {
    endMilliseconds=end.getTime();
  }
  intent.putExtra("endTime",endMilliseconds);
  intent.putExtra("title",summary);
  intent.putExtra("eventLocation",location);
  intent.putExtra("description",description);
  if (attendees != null) {
    intent.putExtra(Intent.EXTRA_EMAIL,attendees);
  }
  try {
    rawLaunchIntent(intent);
  }
 catch (  ActivityNotFoundException anfe) {
    Log.w(TAG,"No calendar app available that responds to " + Intent.ACTION_INSERT);
    intent.setAction(Intent.ACTION_EDIT);
    launchIntent(intent);
  }
}

private void addCalendarEvent ( String summary , Date start , boolean allDay , Date end , String location , String description , String [ ] attendees ) { Intent intent = new Intent ( Intent . ACTION_INSERT ) ; intent . setType ( "vnd.android.cursor.item/event" ) ; long startMilliseconds = start . getTime ( ) ; intent . putExtra ( "beginTime" , startMilliseconds ) ; if ( allDay ) { intent . putExtra ( "allDay" , true ) ; } long endMilliseconds ; if ( end == null ) { if ( allDay ) { endMilliseconds = startMilliseconds + 24 * 60 * 60 * 1000 ; } else { endMilliseconds = startMilliseconds ; } } else { endMilliseconds = end . getTime ( ) ; } intent . putExtra ( "endTime" , endMilliseconds ) ; intent . putExtra ( "title" , summary ) ; intent . putExtra ( "eventLocation" , location ) ; intent . putExtra ( "description" , description ) ; if ( attendees != null ) { intent . putExtra ( Intent . EXTRA_EMAIL , attendees ) ; } try { rawLaunchIntent ( intent ) ; } catch ( ActivityNotFoundException anfe ) { Log . w ( TAG , "No calendar app available that responds to " + Intent . ACTION_INSERT ) ; intent . setAction ( Intent . ACTION_EDIT ) ; launchIntent ( intent ) ; } }
sends an intent to create a new calendar event by prepopulating the add event ui . older versions of the system have a bug where the event title will not be filled out .
