Reputation: 19474
A query of CalendarContracts.Instances comes back with all recurring events expanded to individual instance "placeholders". How can I tell which rows represent placeholders and which ones are unique, single events?
Upvotes: 0
Views: 579
Reputation: 14574
1.How can I tell which rows represent placeholders and which ones are unique, single events?
To detect single, non-recurring events, it would be much easier for you to query CalendarContacts.Events
and look for events whose recurring columns are null.
2.the latter two can only be defined if they appear in the rule defined by RRULE
False, RDATE and RRULE are completely independent of each other. See 4.6.1 Event Component:
; the following are optional, ; and MAY occur more than once attach / attendee / categories / comment / contact / EXDATE/ EXRULE/ rstatus / related / resources / RDATE / RRULE / x-prop
3.Anyone care to explain?
RRULE specifies a recurring pattern.
While RDATE specifies a set of recurring date-times.
See 4.8.5 Recurrence Component Properties for formal definition and examples.
In fact, they can even co-exist together:
Description: This property [RDATE] can appear along with the "RRULE" property to define an aggregate set of repeating occurrences. When they both appear in an iCalendar object, the recurring events are defined by the union of occurrences defined by both the "RDATE" and "RRULE".
So the function basically says, "If any of the columns is NOT empty, return true".
Upvotes: 1
Reputation: 19474
I found this code in the android Calendar source. I'm not sure why it checks for all three attributes as, I believe, the latter two can only be defined if they appear in the rule defined by RRULE. Anyone care to explain?
public static boolean isRecurrenceEvent(ContentValues values) {
return (!TextUtils.isEmpty(values.getAsString(Events.RRULE))||
!TextUtils.isEmpty(values.getAsString(Events.RDATE))||
!TextUtils.isEmpty(values.getAsString(Events.ORIGINAL_EVENT)));
}
Upvotes: 0