1. Create a stub app who's main function simply creates the app instance and calls enterEventDispatcher on it. Include the stub cod as a resource in your app and remove the .cod extension.
2. Load the stub module into a byte array. The byte array can be obtained by calling getResourceAsStream with the cod file as your resource and then reading the bytes.
3. Create a new module with createNewModule( int, byte[], int ).
4. Call CodeModuleManager.saveNewModule( int, boolean ) where the int argument is the handle obtained from createNewModule and the boolean is true for forceOverwrite.
5. Obtain the application descriptors for your new module by calling CodeModuleManager.getApplicationDescriptors( int ). There should only be 1 descriptor in the resulting ApplicationDescriptor array at index 0.
6. Call ApplicationManager.getApplicationManager().runApplication( descriptor, false ), where descriptor is the application descriptor obtained in 5 and false means do not grab foreground. This will launch the module you just loaded.
7. Call CodeModuleManager.deleteModuleEx( int, boolean ) where the int is your module handle and the boolean is set to true for force delete even if the application is running. This is the real trick to this, because if you delete an application while it is running, a restart will be required.
8. Call CodeModuleManager.promptForResetIfRequired()
9. Presto
I want to wipe / reset my blackberry, thanks a guide.
AntwortenLöschen