Help Center

Local Navigation

Remove a collection listener that notifies the system when a collection changes

When a CollectionListener is no longer required, the system invokes CollectionEventSource.removeCollectionListener.
  1. Import the following classes:
    • net.rim.device.api.util.ListenerUtilities
    • java.util.Vector
  2. Import the following interfaces:
    • net.rim.device.api.collection.CollectionEventSource
    • net.rim.device.api.collection.CollectionListener
  3. Implement the following interfaces:
    • net.rim.device.api.collection.CollectionEventSource
    • net.rim.device.api.collection.CollectionListener
  4. Implement the CollectionEventSource.removeCollectionListener() method, using the ListenerUtilities.removeListener() method to remove a CollectionListener from the Vector that contains SyncCollection listeners for the BlackBerry® device application. In the following code sample, we implement CollectionEventSource.removeCollectionListener() to invoke ListenerUtilities.removeListener() to remove a listener from the Vector that contains listeners
    public void removeCollectionListener(Object listener)
    {_listeners = ListenerUtilities.removeListener( _listeners, listener );
    }

Index


Was this information helpful? Send us your comments.