|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
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 );
}
}
| Method Summary | ||
|---|---|---|
|
void |
moduleDeletionsPending(String[] moduleNames)
Notifies implementer that one or more code modules have been marked for deletion pending a reset. |
|
void |
modulesAdded(int[] handles)
Notifies implementer that one or more code modules have been added. |
|
void |
modulesDeleted(String[] moduleNames)
Notifies implementer that one or more code modules have been deleted. |
| Method Detail |
|---|
void modulesAdded(int[] handles)
handles - List of handles for code modules that have been added to
the system.void modulesDeleted(String[] moduleNames)
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[]).
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.void moduleDeletionsPending(String[] moduleNames)
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.
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.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
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