net.rim.device.api.system
Interface CodeModuleListener


public interface CodeModuleListener

Listener interface used to receive code module events. The listener used to receive notifications regarding the addition, modification, or deletion of code modules on the device.

Example: Implementing a code module listener Your implementation should avoid doing any long-running work within the CodeModuleListener event handler methods (if you do have long running work to do, then you should spin that work off onto worker threads). This sample does all the work within the context of the handlers, because the operations are brief in nature:

 final class SimpleModuleNameList implements CodeModuleListener {
 
     private ToIntHashtable _modulesList;
 
     public SimpleModuleNameList() {
 
         // build up initial list of module names for all modules (younger
         // siblings included)
         int[] hList = CodeModuleManager.getModuleHandles(true);
         _modulesList = new ToIntHashtable(hList.length);
 
         for( int i = (hList.length - 1); i >= 0; i-- ) {
             _modulesList.put( CodeModuleManager.getModuleName(hList[i]), hList[i] );
         }
     }
 
     public void modulesAdded( int[] handles ) {
         for( int i = (handles.length - 1); i >= 0; i-- ) {
             _modulesList.put( CodeModuleManager.getModuleName(handles[i]), handles[i] );
         }
     }
 
     public void modulesDeleted( String[] moduleNames ) {
         for( int i = (moduleNames.length - 1); i >= 0; i-- ) {
             // note that we might get passed a null entry in the names list
             if( _moduleNames[i] != null ) {
                 _modulesList.remove( moduleNames[i] );
             } else {
                 continue;
             }
         }
     }
 
     public void moduleDeletionsPending( String[] moduleNames ) {
         // pass on to modulesDeleted as we don't distinguish between deletes
         // and pending deletes
         modulesDeleted( moduleNames );
     }
 }
 

Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 5.0.0

Method Summary
Category: Signed  void moduleDeletionsPending(String[] moduleNames)
          Notifies implementer that one or more code modules have been marked for deletion pending a reset.
Category: Signed  void modulesAdded(int[] handles)
          Notifies implementer that one or more code modules have been added.
Category: Signed  void modulesDeleted(String[] moduleNames)
          Notifies implementer that one or more code modules have been deleted.
 



Method Detail

modulesAdded

void modulesAdded(int[] handles)
Notifies implementer that one or more code modules have been added.

Parameters:
handles - List of handles for code modules that have been added to the system.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 5.0.0

modulesDeleted

void modulesDeleted(String[] moduleNames)
Notifies implementer that one or more code modules have been deleted.

The system will only report the names of the modules fully deleted; those only marked for deletion pending a reset will get reported via CodeModuleListener.moduleDeletionsPending(String[]).

Parameters:
moduleNames - List of names for the code modules that the system has deleted; an element in this array might be null, if the system could not determine the name of the deleted module.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 5.0.0

moduleDeletionsPending

void moduleDeletionsPending(String[] moduleNames)
Notifies implementer that one or more code modules have been marked for deletion pending a reset.

The system will only report the names of modules pending deletion after a reset; those that have actually been deleted get reported via CodeModuleListener.modulesDeleted(String[]). Note that a module that is marked for deletion pending a reset, and reported with this event, will not be further reported with modulesDeleted() after the reset.

Parameters:
moduleNames - List of names for the code modules that the system has marked for deletion pending a reset; an element in this array might be null, if the system could not determine the name of the deleted module.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 5.0.0





Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal