Question

I'm trying to add new event to android calendar (Android 2.3). So far, it works very well.

ContentValues event = new ContentValues();
event.put("calendar_id", calendarId);
event.put("title", value.get("name") + "'s Birthday");
event.put("description", "This is a simple test for calendar api");
event.put("dtstart", eventDate.getTimeInMillis());
event.put("dtend", eventDate.getTimeInMillis());
event.put("eventTimezone", TimeZone.getTimeZone("UTC").getID());
event.put("allDay", 1);
event.put("rrule", "FREQ=YEARLY");
event.put("eventStatus", 1);
this.getContentResolver().insert("content://com.android.calendar/events", event);

If I view the event on my HTC One calendar, it is shown as an all day event. But there are two rows for this type of event in the weekly calendar view. One row stands for normal all day events, the other stands for birthdays. I think the setting of a event type is the right way to do this, but I don't know how I get this working. It seems there is no table column which is associated to something like a event type (or a category).

Are there any possibilities to set event types?

No correct solution

OTHER TIPS

As far as I know, there is no event type attribute in CalendarContract. For HTC One calendar, it is highly possible that they create their "Local Birthday Calendar", and then the events in birthday calendar will be shown as "birthday events"

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top