Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

How to list the supported fields in a PIMList

From 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 06:01.
44 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×