I am trying to create a calendar event using this code:
but I am getting this exception : "java.lang.IllegalArgumentException: Unknown URL content://com.android.calendar/events".
Can anyone tell what is the proper uri?Thanks
Code:
ContentValues event = new ContentValues();
event.put("calendar_id", calId);
event.put("title", subject);
event.put("description", "");
event.put("eventLocation", "");
long startTime = System.currentTimeMillis() + 1000 * 60 * 60;
long endTime = System.currentTimeMillis() + 1000 * 60 * 60 * 2;
event.put("dtstart", startTime);
event.put("dtend", endTime);
event.put("allDay", 0); // 0 for false, 1 for true
event.put("eventStatus", 1);
event.put("visibility", 0);
event.put("transparency", 0);
event.put("hasAlarm", 0); // 0 for false, 1 for true
Uri eventsUri = Uri.parse("content://com.android.calendar/events");
Uri insertedUri = getContentResolver().insert(eventsUri, event);
but I am getting this exception : "java.lang.IllegalArgumentException: Unknown URL content://com.android.calendar/events".
Can anyone tell what is the proper uri?Thanks
