Notify An Application When A List Of Events Changes; Notify An Application When The Default List Of Events On A Blackberry Device Changes - Blackberry JAVA DEVELOPMENT ENVIRONMENT - - DEVICE APPLICATIONS INTEGRATION - DEVELOPMENT GUIDE Integration Manual

Blackberry device applications integration guide
Table of Contents

Advertisement

Task
Import an appointment.
Close an event list.
See "Code sample: Creating new recurring appointments" on page 43 for more information.

Notify an application when a list of events changes

1.
Create a class that implements the
public class myEventListListener implements PIMListListener {
2. To register to receive notifications of changes to an event list, invoke
BlackBerryPIMList eventList =
(BlackBerryPIMList)PIM.getInstance().openPIMList(PIM.EVENT_LIST, PIM.READ_WRITE);
eventList.addListener(new myEventListListener());
Notify an application when the default list of events on a BlackBerry device
changes
When an update occurs to the list of services on a BlackBerry device, the list of organizer data databases on a
device may change. This action may result in the creation of a new default list of events.
1.
Create a class that implements the
public class myEventListListener3 implements PIMListListener3 {
Steps
PIMItem
1. To return an array of
is, java.lang.String enc).
2. To add a new appointment, invoke
// Convert an existing appointment into a iCal and then import the iCal as
a new
// appointment.
String[] dataFormats = PIM.eventSerialFormats();
// Write appointment to iCal.
ByteArrayOutputStream os = new ByteArrayOutputStream();
PIM.getInstance().toSerialFormat(event, os, "UTF8", dataFormats[0]);
// Import appointment from iCal.
ByteArrayInputStream is = new
ByteArrayInputStream(outputStream.toByteArray());
PIMItem[] pi = PIM.getInstance().fromSerialFormat(is, "UTF8");
EventList eventList = (EventList)PIM.getInstance().openPIMList(
PIM.EVENT_LIST, PIM.READ_WRITE);
Event event2 = eventList.importEvent((Event)pi[0]);
close()
1. Invoke
.
2. Create a try-catch block to manage a
try {
eventList.close();
} catch (PimException e) {
// Handle exception.
}
PIMListListener
PIMListListener3
SerialFormat(java.io.InputStream
objects, invoke from
EventList.importEvent().
PimException
.
interface.
BlackBerryPIMList.addListener()
interface.
4: Using the calendar
.
31

Advertisement

Table of Contents
loading

This manual is also suitable for:

Java development environment 4.6.0

Table of Contents