Reading contacts from PIM

Hi.

Ive been trying to read contact from PIM for a long time now and search the web over and over again but this just doesnt work. It work on all phones EXCEPT the SonyEricsson w950, where i only get the NAME_FAMILY, i also tried to replace NAME_FAMILY with all other NAME fields without success. And i tried to use the toSerialFormat but it is so slow on the w950 so i really want to be able to do it without the toSerialFormat. Any one with some information how to solve this issue?

Code:

PIMpim = PIM.getInstance();

String[] data_formats = pim.supportedSerialFormats(PIM.CONTACT_LIST);

ContactListcontactList = (ContactList) pim.openPIMList(PIM.CONTACT_LIST, PIM.READ_ONLY);

int[] tmpFields;

String tempNames = "";

// SEARCH CONTACT

Enumeration contacts = contactList.items();

Contact c;

while(contacts.hasMoreElements()){

c = (Contact) contacts.nextElement();

tmpFields = c.getFields();

try {

tempNames += c.getStringArray(Contact.NAME, Contact.NAME_GIVEN)[0]+ " ";

} catch (Exception e) {}

}

try {

tempNames += c.getStringArray(Contact.NAME, Contact.NAME_FAMILY)[0]+ ":";

} catch (Exception e) {}

}

[1241 byte] By [Pipena] at [2007-11-27 8:58:10]
# 1
check out this http://developer.sonyericsson.com/util/SearchCMS.do?criteria=PIM&x=0&y=0
suparenoa at 2007-7-12 21:23:43 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 2
i've been there a lot, without any success..
Pipena at 2007-7-12 21:23:43 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 3
could you try to display the Exception (if exists ) with an Alert screen when you don't use toSerialFormat param
suparenoa at 2007-7-12 21:23:43 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 4
I get an arrayIndexOutOfBounds on the Concact.NAME_GIVEN
Pipena at 2007-7-12 21:23:43 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 5
so test the size array before accessing it !( and you can although display the stuff present in the array !)
suparenoa at 2007-7-12 21:23:43 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 6

ive been trying to do everything, looping through:

for (int i = 0; i < 256; i++) {

try {

tempName+= c.getStringArray(Conctact.NAME, i)[0];

catch (Exception e) {

}

}

this pnly gives me NAME_FAMILY for the contacts where it is set, and an empty space for the NAME_FAMILY where onle the first name is set. But i never get the first name...

Pipena at 2007-7-12 21:23:43 > top of Java-index,Java Mobility Forums,Java ME Technologies...