Java Reference
In-Depth Information
The
EventRepeat
class is an encapsulation of the
RRULE
field in a vCalendar element. It is used to
determine how often an event occurs. The repetition details of the event are set using the
setInt()
method, taking a field ID and an
int
value as parameter. The valid parameter combinations are shown
taking the END field constant and a valid date as parameters.
Table 7.3. Field ID Constants and valid values for the
setInt()
method of the
EventRepeat
class
Field IDs
Valid Values
COUNT
a
ny positive int
FREQUENCY
D
AILY
,
WEEKLY
,
MONTHLY
,
YEARLY
INTERVAL
any positive int
MONTH_IN_YEAR
JANUARY
,
FEBRUARY
,
MARCH
,
APRIL
,
MAY
,
JUNE
,
JULY
,
AUGUST
,
S
EPTEMBER
,
OCTOBER
,
NOVEMBER
,
DECEMBER
DAY_IN_WEEK
SUNDAY
,
MONDAY
,
TUESDAY
,
WEDNESDAY
,
THURSDAY
,
FRIDAY
,
SATURDAY
WEEK_IN_MONTH
FIRST
,
SECOND
,
THIRD
,
FOURTH
,
FIFTH
,
LAST
,
SECONDLAST
,
THIRDLAST
,
FOURTHLAST
,
FIFTHLAST
DAY_IN_MONTH
1
-31
DAY_IN_YEAR
1-366
The following snippet shows how a repeat pattern is added to an event:
EventList myEvents = PIM.openEventList(PIM.READ_WRITE);
Event myEvent = myEvents.createEvent();
Date startDate = new Date();
myEvent.setString(Event.SUMMARY, "Weekly developer meeting.");
myEvent.setDate(Event.START, startDate);
myEvent.setDate(Event.ALARM, new Date(startDate.getTime() - 60000));
EventRepeat repeat = new EventRepeat();
repeat.setInt(EventRepeat. DAY_IN_WEEK, EventRepeat.MONDAY);
myEvent.setRepeat(repeat);
myEvent.commit();
myEvents.close();
In the following section, we will describe the list related calls used in this code snippet in more detail.
EventList
s for Handling
Event
s
For access to the event database, the PIM class provides
openEventList()
and
listEventLists()
methods analogous to the methods available for obtaining contact lists. The
behavior of those methods is as described in the previous section about contact lists, except that the
openEventList()
methods both return instances of
EventList
. Like
ContactList
,
EventList
extends the general
PIMList
interface. In addition to the PIMList functionality, it
provides a new elements() method, returning an enumeration containing all
Event
elements ranging
from a start date to a specified end date.
ToDo API
Search WWH ::
Custom Search