Welcome to the Official BlackBerry® Support Community Forums. This is your resource to discuss support topics with your peers, and learn from each other. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
New Developer
petritis
Posts: 14
Registered: 07-16-2008
Accepted Solution

How to Map an address that is not in the Address Book

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 

Please use plain text.
Administrator
MSohm
Posts: 11,465
Registered: 07-09-2008
My Carrier: Bell

Re: How to Map an address that is not in the Address Book

You could create a contact object with your address and pass it to BlackBerry Maps.  The contact does not need to be stored in the Address Book.
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Found a bug? Report it using the Issue Tracker
Please use plain text.
New Developer
petritis
Posts: 14
Registered: 07-16-2008

Re: How to Map an address that is not in the Address Book

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.CONTACT_LIST, PIM.WRITE_ONLY);
            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;
        }
    }

Please use plain text.
New Developer
petritis
Posts: 14
Registered: 07-16-2008

Re: How to Map an address that is not in the Address Book

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";
 

Please use plain text.