[android-developers] Add Weekly,Fortnightly,Monthly Recurring events to calendar.
I'm trying to add event to the calendar programatically in Android API
11. It does not seem to be working, I've pasted the code, also didn't
find anything on adding fortnightly events. Please if anyone can tell
what is the issue in the code below.
ContentValues event = new ContentValues();
event.put("calendar_id", 1);
event.put("title", title);
event.put("description", description);
event.put("eventLocation", location);
event.put("dtstart", startDate);
switch (recurrance) {
case DAILY:
event.put("rrule", "FREQ=DAILY");
break;
case MONTHLY:
event.put("rrule", "FREQ=MONTHLY");
break;
case WEEKLY:
event.put("rrule", "FREQ=WEEKLY");
break;
case FORTNIGHTLY:
event.put("rrule", "FREQ=YEARLY"); //CODE for Fortnight to be
added.
break;
}
event.put("dtend", endDate);
if (Integer.parseInt(Build.VERSION.SDK) >= 8) {
Uri eventsUri = Uri.parse("content://com.android.calendar/events");
resolver.insert(eventsUri, event);
} else {
Uri eventsUri = Uri.parse("content://calendar/events");
resolver.insert(eventsUri, event);
}
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home