Blackberry JAVA DEVELOPMENT ENVIRONMENT - - DEVICE APPLICATIONS INTEGRATION - DEVELOPMENT GUIDE Integration Manual page 30

Blackberry device applications integration guide
Table of Contents

Advertisement

BlackBerry Device Applications Integration Guide
Task
Save an appointment.
Retrieve appointment information.
Export an appointment.
30
Steps
To save an appointment, use the
1. Before you save the appointment, to identify appointment fields that have changed since the
appointment was last saved, invoke i
commit()
2. Invoke
.
if(event.isModified()) {
event.commit();
}
1. To retrieve an enumeration of appointments, invoke
ventList eventList = (EventList)PIM.getInstance().openPIMList(
E
PIM.EVENT_LIST, PIM.READ_ONLY);
Enumeration e = eventList.items();
2. To retrieve an array of IDs of fields that have data for a particular task, invoke
PIMItem.getFields()
3. To retrieve the field values, invoke
while (e.hasMoreElements()) {
Event event = (Event)e.nextElement();
int[] fieldIds = event.getFields();
int id;
for(int index = 0; index < fieldIds.length; ++index) {
id = fieldIds[index];
if(e.getPIMList().getFieldDataType(id) == STRING) {
for(int j=0; j < event.countValues(id); ++j) {
String value = event.getString(id, j);
System.out.println(event.getFieldLable(id) + "=" + value);
}
}
}
}
1. To import or export PIM item data, use an output stream writer to export tasks from the
BlackBerry® device to a supported serial format, such as iCal®.
2. To retrieve a string array of supported serial formats, invoke
PIM.supportedSerialFormats()
3. To write an item in serial format, invoke
character encoding to use when writing to the output stream. Supported character encodings
include "UTF8," "ISO-8859-1," and "UTF-16BE". This parameter cannot be null.
EventList eventList = (EventList)PIM.getInstance().openPIMList(
PIM.EVENT_LIST, PIM.READ_ONLY );
ByteArrayOutputStream bytestream = new ByteArrayOutputStream();
Enumeration e = eventList.items();
while (e.hasMoreElements()) {
Event event = (Event)e.nextElement();
PIM.getInstance().toSerialFormat(event, byteStream, "UTF8",
dataFormats[0]);
}
importEvent()
method; you do not have to invoke
sModified()
.
PIMList.items()
.
PIMItem.getString().
, and then specify the list type (
toSerialFormat()
commit()
.
PIM.EVENT_List)
.
. The enc parameter specifies the
.

Advertisement

Table of Contents
loading

This manual is also suitable for:

Java development environment 4.6.0

Table of Contents