Open BlackBerry Maps by using information from a contact
You can open BlackBerry Maps to display a location on a map by using the address information from a contact in the contacts application on the BlackBerry device.
Code sample: Invoking BlackBerry Maps by using information from a contact
import net.rim.blackberry.api.invoke.*;
import javax.microedition.pim.*;
public class invokeMaps
{
public invokeMaps()
{
ContactList contacts = null;
try
{
contacts = (ContactList) PIM.getInstance().openPIMList
(PIM.CONTACT_LIST, PIM.READ_ONLY);
}
catch (PIMException e)
{
return;
}
Contact contact = contacts.createContact();
contact.addString(Contact.FORMATTED_NAME, PIMItem.ATTR_NONE,
"Ms. Andrea Aime");
contact.addString(Contact.FORMATTED_ADDR, PIMItem.ATTR_NONE,
"455 Phillip St. Waterloo ON N2L3X2 Canada");
String[] name = new String[ contacts.stringArraySize( Contact.NAME ) ];
name[ Contact.NAME_GIVEN ] = "Andrea";
name[ Contact.NAME_FAMILY ] = "Aime";
name[ Contact.NAME_PREFIX ] = "Ms.";
String[] addr = new String[ contacts.stringArraySize( Contact.ADDR ) ];
addr[ Contact.ADDR_STREET ] = "455 Phillip St";
addr[ Contact.ADDR_LOCALITY ] = "Waterloo";
addr[ Contact.ADDR_REGION ] = "ON";
addr[ Contact.ADDR_POSTALCODE ] = "N2L3X2";
addr[ Contact.ADDR_COUNTRY ] = "Canada";
MapsArguments mapsArgs = new MapsArguments(contact, 0);
Invoke.invokeApplication(Invoke.APP_TYPE_MAPS, mapsArgs);
}
}
Previous topic: Open
BlackBerry Maps by using the default
settings