hi,
I am trying to develop an application than can transfer contact from my phone to j2se application with obex. When I try to transfer contacts without address(only phone number and name) the application can run well. But when I try to transfer contacts with address, my application is hang after successfully transfering a few contacts.
This is the code of my midlet

PIM pim = PIM.getInstance();
ContactList contactList = (ContactList) pim.openPIMList(PIM.CONTACT_LIST, PIM.READ_ONLY);
Enumeration contacts = contactList.items();

while (contacts.hasMoreElements()) {
Contact contact = (Contact) contacts.nextElement();
int telCount = contact.countValues(Contact.TEL);
int namesCount = contact.countValues(Contact.NAME);
int addressCount = contact.countValues(Contact.ADDR);

if (telCount > 0 && namesCount > 0) {
String firstName;
String lastName;
String mobileNumber = "";
String phoneNumber = "";
String address = "";

String[] names = contact.getStringArray(Contact.NAME, 0);
firstName = names[Contact.NAME_GIVEN];
lastName = names[Contact.NAME_FAMILY];

String name;
if (firstName == null) {
name = lastName;
} else if (lastName == null) {
name = firstName;
} else {
name = firstName + " " + lastName;
}

for (int i = 0; i < telCount; i++) {
int telAttribute = contact.getAttributes(Contact.TEL, i);
String telNumber = contact.getString(Contact.TEL, i);
if (telAttribute == PIMItem.ATTR_NONE) {
mobileNumber = telNumber;
} else if (telAttribute == Contact.ATTR_HOME) {
phoneNumber = telNumber;
} else {
mobileNumber = telNumber;
}
}

//if(addressCount > 0) {
// String[] arrayAddress = contact.getStringArray(Contact.ADDR, PIMItem.ATTR_NONE);
// try {
// address = arrayAddress[Contact.ADDR_STREET];
// } catch (IndexOutOfBoundsException e) {
// }
//}

out.writeUTF(name);
out.writeUTF(mobileNumber);
out.writeUTF(phoneNumber);
out.writeUTF(address);
out.flush();
}
}

If I remove the commented lines, my application can run well and transfer all contacts to j2se application. Please help me to fix this problem.

Regards

Yulias K