Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Use Remote Address Lookup through coding

by Retired ‎02-16-2010 09:10 AM - edited ‎09-16-2010 03:00 PM (2,804 Views)



This article applies to the following:


  • BlackBerry® Java™ Development Environment (JDE) 4.0
  • BlackBerry Device Software 4.0



Users with an account on the BlackBerry Enterprise Server™ can do a remote address lookup of contacts in the corporate address book using a BlackBerry wireless device. Third-party applications are also able to take advantage of this functionality using the Personal Digital Assistant Profile (PDAP) application programming interfaces (API) that appear below.

First the application must implement the RemoteLookupListener, so it will be notified when remote lookups return a set of results.



final class RemoteLookupDemo extends UiApplication implements RemoteLookupListener


The application implementing the RemoteLookupListener interface must also implement any methods that are part of that interface. The only method in the interface is the items() method. The items() method is called when a lookup has a set of results: valid or invalid. An enumeration of Contact objects is passed into the method with the results.

//this sample reads through the enumeration of contacts



//this sample reads through the enumeration of contacts

//and counts the number of contacts that were returned

public void items(Enumeration results) {

int count = 0;

while (results.hasMoreElements()) {

//alternatively you can do

//Contact contact = (Contact)results.nextElement();

//this would return the contact for manipulation




System.out.println("Number of Contacts: " + count);



Once the application can receive the remote lookup results, the application can perform the actual lookup.


try {

//retrieve an instance of PIM

PIM pim = PIM.getInstance();

//open the contact list for read/write permissions

BlackBerryContactList contactList = (BlackBerryContactList)



//use the lookup method specifying the partial name

//to perform the remote address lookup on

contactList.lookup("Joe", this);

} catch (Exception ex) {




Users Online
Currently online: 32 members 2,530 guests
Please welcome our newest community members: