O'Reilly logo

BlackBerry Java Application Development by Bill Foust

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action - adding telephone numbers

  1. Add the following code to the run method of the AddTestContacts menu item.
    //TODO: Add Phone numbers
    newContact1.addString(BlackBerryContact.TEL, BlackBerryContact.ATTR_MOBILE, "555-555-1212");
    newContact2.addString(Contact.TEL,Contact.ATTR_HOME, "555-555-1234");
    newContact2.addString(Contact.TEL,Contact.ATTR_FAX, "555-555-9999");
    newContact2.addString(Contact.TEL, Contact.ATTR_MOBILE,"555-555-1313");
    // This is bad!
    newContact2.addString(Contact.TEL,Contact.ATTR_FAX, "555-555-1414");
    

What just happened?

Working with phone numbers may look very straightforward, but there are many pitfalls to look out for here as well. Each phone number is added using the addString method, which should look similar to the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required