The EventList class represents a database containing calendar entries (also known as calendar events) of a specific type. The Event class is used to represent individual calendar entries. You can use EventLists to access the calendar information available on a device.
Nokia Asha and Series 40 software platform devices have at least one calendar available: the default, native calendar stored in device memory. Depending on the device, more calendars can be available. On Nokia Asha and Series 40 software platform device, MIDlets can only access the default calendar.
The PIM API represents each available calendar as a set of EventLists. Each EventList contains calendar entries of a specific type and carries a predefined name based on that type. The name is the same across calendars. The exact EventList names depend on the platform. Moreover, the names are localized, so the exact names additionally depend on the locale selected on a device. Therefore, never hard-code the names in a MIDlet, but rather obtain them dynamically by using the PIM.listPIMLists method as shown in the instructions below.
Nokia Asha and Series 40 software platform devices support different calendar entry types. Although the exact type names differ from device to device, the types can be abstractly represented as follows:
Meeting
Call
Birthday
Memo
Reminder
The PIM.listPIMLists method always returns the names in the above order.
To access the default calendar on a device:
Retrieve the EventList names supported by the device by using the PIM.listPIMLists method:
PIM pim = PIM.getInstance(); String[] eventListNames = pim.listPIMLists(PIM.EVENT_LIST);
The return value is a string array containing the localized EventList names. The names are returned in the order shown above.
Select what type of calendar entries, that is, which EventList you want to access. You can either force the selection yourself by selecting a specific item from the string array returned by the PIM.listPIMLists method, or you can allow the user to select the type. For example, to select the second item:
String eventListName = eventListNames[1];
Open the EventList by using the PIM.openPIMList(int pimListType, int mode, String name) method, with the name of the database specified in the name parameter:
EventList eventList = (EventList)pim.openPIMList(PIM.EVENT_LIST, PIM.READ_WRITE, eventListName);
Use the EventList and Event methods to read and write data from and to the opened EventList.
For information about the supported EventList fields and attributes, see the PIM API implementation notes.
For examples on using the calendar and event list functions on a device, see the following articles in the Nokia Developer Wiki:
Nokia Asha software platform does not support different calendar entry types. PIM.listPIMList(PIM.TODO_LIST) will return "Calendar" only.