07-28-2008 12:49 AM
Is there some way I can map an address that is not in the Address Book?
All the methods I can find to Invoke the map application either take latitude and longitude or they take a Contacts object from the Address book.
I just have an address that I would like it to display for me.
I guess I can use google maps instead, but would rather not have to.
Thanks
Solved! Go to Solution.
07-28-2008 10:15 AM
07-28-2008 10:12 PM
Here is some code showing how to display an address:
void showMap() {
Contact contact = MapShow.getContactFor();
Invoke.invokeApplication(Invoke.APP_TYPE_MAPS, new MapsArguments(contact, 0));
}
static Contact getContactFor()
{
try {
ContactList contactList = (ContactList)PIM.getInstance().openPIMList(PIM.CON
Contact contact = contactList.createContact();
String[] name = new String[5];
try {
name[Contact.NAME_OTHER] = "Disney World";
} catch(IllegalArgumentException e) {
return null;
}
if (contactList.isSupportedField(Contact.NAME)) {
contact.addStringArray(Contact.NAME, Contact.ATTR_NONE, name);
}
String[] address = new String[7];
try {
address[Contact.ADDR_COUNTRY] = "United States";
address[Contact.ADDR_LOCALITY] = "Lake Buena Vista";
address[Contact.ADDR_POSTALCODE] = "32830";
address[Contact.ADDR_REGION] = "Florida";
address[Contact.ADDR_STREET] = "1675 N Buena Vista Dr";
} catch(IllegalArgumentException e) {
return null;
}
if (contactList.isSupportedField(Contact.ADDR)) {
contact.addStringArray(Contact.ADDR, Contact.ATTR_NONE, address);
}
return contact;
} catch(PIMException e) {
return null;
}
}
07-28-2008 10:20 PM
Dang it didn't work with that name, instead you need more parts of a name, this worked:
name[Contact.NAME_OTHER] = "Disney World";
name[Contact.NAME_PREFIX] = "Mr.";
name[Contact.NAME_FAMILY] = "Shepard";
name[Contact.NAME_GIVEN] = "Solx";