Namespaces
Variants
Actions

How to list the supported fields in a PIMList

Jump to: navigation, search
SignpostIcon FloppyDisk 52.png
Article Metadata

Article
Created: jarmlaht (15 Jun 2007)
Last edited: hamishwillee (18 Jul 2012)

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 18 July 2012, at 13:24.
71 page views in the last 30 days.
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved