title: How can I add event to the calendar automatically?
body: <p><strong>How can i add event to the calendar automatically?</strong> If I use this source code, it opens Calendar with filled entries, but I must click on save button to save it.</p>
  
  <pre><code>public class CalendarApplicationActivity extends Activity
  {  
  
  public static final String[] EVENT_PROJECTION = new String[] 
  {  
          Calendars._ID, // 0  
          Calendars.ACCOUNT_NAME, // 1  
          Calendars.CALENDAR_DISPLAY_NAME // 2  
  };  
  
  
  private static final int PROJECTION_DISPLAY_NAME_INDEX = 2;  
  
  @Override 
  public void onCreate(Bundle savedInstanceState)
  {  
      super.onCreate(savedInstanceState);  
      setContentView(R.layout.activity_calendar_application);  
  }  
  
  public void onClick(View view) 
  {  
  
      Intent intent = new Intent(Intent.ACTION_INSERT);  
      intent.setType("vnd.android.cursor.item/event");  
      intent.putExtra(Events.TITLE, "Learn Android");  
      intent.putExtra(Events.EVENT_LOCATION, "Home suit home");  
      intent.putExtra(Events.DESCRIPTION, "Download Examples");  
  
      GregorianCalendar calDate = new GregorianCalendar(2012, 10, 02);  
      intent.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME,  
              calDate.getTimeInMillis());  
      intent.putExtra(CalendarContract.EXTRA_EVENT_END_TIME,  
              calDate.getTimeInMillis());  
  
      intent.putExtra(CalendarContract.EXTRA_EVENT_ALL_DAY, true);  
  
  
      intent.putExtra(Events.ACCESS_LEVEL, Events.ACCESS_PRIVATE);  
      intent.putExtra(Events.AVAILABILITY, Events.AVAILABILITY_BUSY);  
  
      startActivity(intent);  
  
  }  
  
  
  }
  </code></pre>