title: Inserting Calendar items in Android ICS
body: <p>For one of my application we have to insert an event into calendar.</p>
  
  <pre><code>long calID = 3;
  long startMillis = 0; 
  long endMillis = 0;     
  Calendar beginTime = Calendar.getInstance();
  beginTime.set(2012, 8, 10, 7, 30);
  startMillis = beginTime.getTimeInMillis();
  Calendar endTime = Calendar.getInstance();
  endTime.set(2012, 8, 10, 8, 45);
  endMillis = endTime.getTimeInMillis();
  ContentResolver cr = getContentResolver();
  ContentValues values = new ContentValues();
  values.put(Events.DTSTART, startMillis);
  values.put(Events.DTEND, endMillis);
  values.put(Events.TITLE, "Jazzercise");
  values.put(Events.DESCRIPTION, "Group workout");
  values.put(Events.CALENDAR_ID, calID);
  values.put(Events.EVENT_TIMEZONE, "America/Los_Angeles");
  Uri uri = cr.insert(CalendarContract.Calendars.CONTENT_URI, values);
  // get the event ID that is the last element in the Uri
  long eventID = Long.parseLong(uri.getLastPathSegment());
  Log.d("MainActivity", "addCalendarEvents :: " + "eventID :: "+eventID);
  
  Cursor cursor = cr.query(Events.CONTENT_URI, null, Events.TITLE +"='Jazzercise'", null, null);
  Log.d("MainActivity", "addCalendarEvents :: " + "cursor :: "+cursor.getCount());
  </code></pre>
  
  <p>Provided on <a href="http://developer.android.com/guide/topics/providers/calendar-provider.html" rel="nofollow">http://developer.android.com/guide/topics/providers/calendar-provider.html</a>
  However, firstly it gives me a error </p>
  
  <pre><code> Failed to get type for: content://com.android.calendar (Unknown URL content://com.android.calendar)
  </code></pre>
  
  <p>Also the cursor count is zero. When i try to search with the title. 
  Note: I tried using the intents service to add events, however I don't want user discretion while adding the event. </p>
  
  <p>I have tested it on a Galaxy Nexus (4.1) and Nexus S(4.1).</p>
  
  <p>Any help with the correct UI which is to be used with ICS?</p>
  
  <p>BR,
  Jayshil</p>