* @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
* Object)
*/
public void execute(final ReadOnlyCommandMetadata metadata,
final Object context) {
Contact c = null;
boolean foundAddress = false;
// Create a list of Contacts from the address book and search
// list
// for first occurrence of a valid address.
try {
// Create list of Contacts
final ContactList contactList =
(ContactList) PIM.getInstance().openPIMList(
PIM.CONTACT_LIST, PIM.READ_WRITE);
final Enumeration enumContact = contactList.items();
// Search for a valid address
while (enumContact.hasMoreElements() && !foundAddress) {
c = (Contact) enumContact.nextElement();
if (c.countValues(Contact.ADDR) > 0) {
final String address[] =
c.getStringArray(Contact.ADDR, 0);
if (address[Contact.ADDR_LOCALITY] != null
&& address[Contact.ADDR_REGION] != null) {
// Invoke maps application for current Contact
Invoke.invokeApplication(Invoke.APP_TYPE_MAPS,