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 - embedding the address book

  1. You first start by overriding the makeMenu method. With this method you can display the menu to access the Address Book application only when the e-mail field is selected.
    if (this.getFieldWithFocus() == _To &&
    context != Menu.INSTANCE_CONTEXT_SELECTION)
    {
    m.add(_AddressBookAction);
    }
    
  2. Then, we need to implement the Run method of the _AddressBookAction menu item.
    PIM pim = PIM.getInstance(); try { BlackBerryContactList contacts = (BlackBerryContactList)pim.openPIMList(PIM.CONTACT_LIST, PIM.READ_WRITE); BlackBerryContact selected = (BlackBerryContact) contacts.choose(); if (selected != null) { int EmailAddressCount = selected.countValues(Contact.EMAIL); // check to make sure that there is an Email address ...

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