×
Namespaces

Variants
Actions

How to list the supported fields in a PIMList

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Article
Created: jarmlaht (15 Jun 2007)
Last edited: hamishwillee (26 Jul 2013)

Overview

When using PIM API and its PIMList class, it is important to find out first, what fields are supported by the implementation. This can be done by using the following kind of method:

private void readSupportedFields() {
System.out.println("EventList contents:");
try {
String[] lists = PIM.getInstance().listPIMLists(PIM.EVENT_LIST);
int length = lists.length;
EventList[] eventList = new EventList[length];
for (int i = 0; i < length; i++) {
eventList[i] = (EventList) PIM.getInstance().openPIMList(PIM.EVENT_LIST, PIM.READ_WRITE, lists[i]);
System.out.println(i+1+": "+lists[i]);
int[] fields = eventList[i].getSupportedFields();
System.out.println("Supported fields:");
for (int j = 0; j < fields.length-1; j++) {
System.out.println(fields[j]+" ");
}
}
} catch (PIMException pe) {
// no such list
} catch (SecurityException se) {
// MIDlet is not allowed to access to the specified list
}
}

If you need to know the supported fields in contact list or to-do list, just replace PIM.EVENT_LIST with PIM.CONTACT_LIST or PIM.TODO_LIST. Note, that you will get only the constant values of the fields, so output might look like this: 1: Meeting Supported fields: 108 107 100 106 102. The actual field names can be found from PIM API specification.

See also

This page was last modified on 26 July 2013, at 09:01.
42 page views in the last 30 days.