Start the module for background processes or the module for the UI

  1. Import the net.rim.blackberry.api.messagelist.ApplicationMessageFolderRegistry class.
  2. Create a main method for the BlackBerry®device application.
    public static void main( String[] args )
    {
    try {
  3. In the main() method, check if the value of the args parameter indicates that the BlackBerrydevice application should start the daemon module.
    if( args.length == 1 && args[ 0 ].equals( "daemon" ) ) {
  4. Create an instance of a class that contains the daemon functionality and items.
    MLSampleDaemon daemon = new MLSampleDaemon();
  5. Obtain a reference to the ApplicationMessageFolderRegistry.
    ApplicationMessageFolderRegistry reg = ApplicationMessageFolderRegistry.getInstance();
  6. In the main() method, check if the value of the args parameter indicates that the BlackBerrydevice application should start the UI module.
    } else if( args.length == 1 && args[ 0 ].equals( "gui" ) ) {
  7. Create an instance of a class that contains the UI functionality and items.
    MLSampleGui gui = new MLSampleGui();
  8. Display the UI for the BlackBerrydevice application .
    gui.showGui();
  9. Add the application to the event dispatcher.
    gui.enterEventDispatcher();

Index


Was this information helpful? Send us your comments.