Notify The System When A Collection Changes; Runtime Storage; Retrieve The Runtime Store - Blackberry JAVA DEVELOPMENT ENVIRONMENT - - DEVELOPMENT GUIDE Manual

Version: 4.7.0
Hide thumbs Also See for JAVA DEVELOPMENT ENVIRONMENT - - DEVELOPMENT GUIDE:
Table of Contents

Advertisement

Development Guide
• 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 );
}

Notify the system when a collection changes

1.
Import the net.rim.device.api.collection.CollectionListener interface.
2.
To notify the system when an element is added to a SyncCollection, invoke
CollectionListener.elementAdded().
for( int i=0; i<_listeners.size(); i++ )
{
CollectionListener cl = (CollectionListener)_listeners.elementAt( i );
cl.elementAdded( this, object );
}
return true;
}
3.
To notify the system when an element in a SyncCollection is replaced, invoke
CollectionListener.elementUpdated().
4.
Invoke CollectionListener.elementRemoved().

Runtime storage

BlackBerry® devices use a runtime store as a central location in which BlackBerry Java® Applications can share runtime objects.
By default, only BlackBerry Java Applications that Research In Motion digitally signs can access data in the runtime store. Contact
RIM for information about how to control access to your data.
The runtime store is not persistent. When you restart the BlackBerry device, the data in the runtime store clears.

Retrieve the runtime store

1.
Import the net.rim.device.api.system.RuntimeStore class.
2.
Invoke RuntimeStore.getRuntimeStore().
RuntimeStore store = RuntimeStore.getRuntimeStore();
Runtime storage
51

Advertisement

Table of Contents
loading

This manual is also suitable for:

Java development environment

Table of Contents