This is how you can set up an alternate entry point for your application:
A- Using the BlackBerry? Java? Plug-in for Eclipse?
After creating the project for the original application, create an alternate entry point to launch the application UI.
1- Double click on BlackBerry_App_Descriptor.xml within your project.
2- Check off System Module and Do not display the application icon on the BlackBerry home screen.
3-Click on the Alternate Entry Point tab.
4- Click the Add button.
5- Enter a title for the entry point and click OK.
6- Specify the application argument that would launch the application using this alternate entry point (for example: gui).
7- Proceed to the Common Steps section.
8- Modify the main() method of the original project as follows:
public static void main(String[] args) {
if ( args != null && args.length > 0 && args[0].equals("gui") ){
// code to initialize the app
theApp.enterEventDispatcher();
} else {
// code to launch the background thread }
}
}
B- Using the BlackBerry JDE
After creating the projects for the original application, you will have to create another project for the UI entry point. Assuming that the thread to be run exists in the same project as the original application, follow these steps:
1- Right-click the project node and select Properties.
2- In the Properties window, select the Application tab.
3- Verify the following options are checked: Auto-run on startup and System module (to register the thread with the system).
4- Create another project under the same folder as the original project. Right-click the new project node and select Properties.
5- Select the Application tab and select Alternate CLDC Application Entry Point from the Project type drop-down list. As shown in the attached file, select the name of the original project (for example, trafficreporter) from the Alternate entry point for drop-down list. Also specify the arguments that would launch the application using this alternate entry point (for example: gui).
Proceed to the Common Steps section.
6- Modify the main() method of the original project as follows:
public static void main(String[] args) {
if ( args != null && args.length > 0 && args[0].equals("gui") ){
// code to initialize the app
theApp.enterEventDispatcher();
} else {
// code to launch the background thread }
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…