04-02-2010 08:35 AM
I have a situation where the Address contains 3 lines plus City,State and Zip, as following
Address 1
Address 2
Address 3
City,
State
Zip
When we use the code to create contact
ContactList contactList = (ContactList) PIM.getInstance().openPIMList(PIM.CONTACT_LIST, PIM.READ_WRITE);
Contact _contact = contactList.createContact();
String[] addressArray =new String[contactList.stringArraySize(Contact.ADDR)];
addressArray[Contact.ADDR_STREET] = "Address1"
addressArray[Contact.ADDR_EXTRA] = "Address 2"
addressArray[Contact.ADDR_LOCALITY] = "City"
addressArray[Contact.ADDR_REGION] = "State"
addressArray[Contact.ADDR_POSTALCODE = "Zip"
I could not find a way to include "Address 3"
What are the options available to include 3 lines in address where we have only "Contact.ADDR_STREET" in addressArray[Contact.ADDR_STREET] and also we can use addressArray[Contact.ADDR_EXTRA].
Please advise
Solved! Go to Solution.
04-02-2010 12:30 PM
There is no address 3. You'd have to use either ADDR_EXTRA (Address2), FORMATTED_ADDR, or USER 1-4 (user defined field) to create your own.
contact.addString(BlackBerryContact.ADDR...)
contact.addString(BlackBerryContact.ADDR_EXTRA...)
contact.addString(BlackBerryContact.FORMATTED_ADDR
With FORMATTED_ADDR, you can specify the entire address as one string. So perhaps...
String ADDR1 = "Name"; String ADDR2 = "Company"; String ADDR3 = "Cube Number"; String STREET = "123 Fake St"; String CITY = "Fake City"; String STATE = "Philadelphia"; String ZIP = "19104"; String ADDRESS = ADDR1 + ", " + ADDR2 + ", " + ADDR3 + ", "...etc contact.addString(BlackBerryContact.FORMATTED_ADDR, PIMItem.ATTR_NONE, ADDRESS);