Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
233 views
in Technique[技术] by (71.8m points)

blackberry - How can run background service application and UIApplication same time

I want to run background service application and UIApplication same time.

Is it possible to create both in same project or need to create separate separate project.

Actually i am confuse in how call or start background service in Event Thread.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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 }
     }
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...