Integrate (RIM java app) with BB address book
First you need to create a class, extend net.rim.blackberry.api.menuitem.ApplicationMenuItem
and override the method run(Object context)
.
This method will be called when the user clicks on your menu item and the context object will be of type javax.microedition.pim.Contact
, so you can get all the relevant address information of the selected item.
Override the toString () method to give your MenuItem a name, eg.
public String toString() {
return "MyMenuItem";
}
Then you need to register your menu item. Create an autorun application, system module and call the following methods:
ApplicationMenuItemRepository.getInstance().addMenuItem(
ApplicationMenuItemRepository.MENUITEM_ADDRESSBOOK_LIST, instanceOfYourApplicationMenuItem
);
ApplicationMenuItemRepository.getInstance().addMenuItem(
ApplicationMenuItemRepository.MENUITEM_ADDRESSCARD_VIEW, instanceOfYourApplicationMenuItem
);
The first call will register the menu item in the address book list view, the second in the detail view (after the address has been opened).
Hope it helps!
source to share