Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Build Your First BlackBerry Java App : Page 4

Learn how to use the freely available BlackBerry JDE to develop, debug, and test BlackBerry applications. Follow this demonstration to create a simple HelloWorld application that exploits some of BlackBerry's own APIs.


advertisement
A Real World "HelloWorld"
At this point, you are ready to see your simple application in action. But before doing so, you need to make sure that your HelloWorldProject has been marked as Active. Doing so tells the BlackBerry simulator which applications it should run. Go to the Project menu and select the Set Active Projects… option. Make sure the HelloWorldProject is checked and click OK.

 
Figure 6. Build the HelloWorldProject and Launch the Simulator

Next, go to the Build menu and select the Build All and Run option (see Figure 6).



 
Figure 7. Launch the BlackBerry Simulator

Now, you should see the BlackBerry Simulator launch as shown in Figure 7.

At this point, you can use the up and down arrow keys to find your HelloWorldProject application amongst the installed applications on the simulator. The up and down arrows simulate the thumb wheel of a real BlackBerry device (see Figure 8).

To choose the application, you can either press the Enter key on your keyboard or the Enter button on the simulator's keyboard. To see how the BlackBerry simulator closely mimics the real life device, you can alternatively click the thumb wheel of the emulator (as shown in Figure 9) to launch the HelloWorld application.

 
Figure 8. Pick the HelloWorldProject Application

 
Figure 9. Thumbwheel of the Simulator

Whichever method you chose to launch the application, your efforts should yield the HelloWorld application on the screen of your emulator (see Figure 10).

To exit out of the application, click the Escape button of your keyboard or the Escape button on the side of the BlackBerry emulator. You should see the Bye World! alert as shown in Figure 11.

Clicking OK should bring you back to the application chooser screen. You can click the File menu and the Exit option to exit out of the simulator.

 
Figure 10. The HelloWorld Application Launched

 
Figure 11. The Bye World! Alert

Multiple Simulation Environments Included
By default, the BlackBerry JDE 4.0.1 uses the BlackBerry 7290 device simulator, but it offers a large number of BlackBerry simulation devices. To choose one, select the Edit menu and the Preferences… option. In the subsequent Preferences window, choose the Simulator tab and pick among the list of available device profiles. Figure 12 shows the selection of the BlackBerry 7100t profile.

Upon a subsequent run of the simulator, you will be able to run the HelloWorld application on the chosen simulator device (see Figure 13).

 
Figure 12. Choose a Profile for Device Simulation

 
Figure 13. Run Your Application on a Simulator

Just Scratching the Surface
This article demonstrated how to develop Java applications for the BlackBerry device. The BlackBerry JDE provides a powerful environment in which you can develop, debug, test, and simulate applications.

Like many IDEs, the BlackBerry JDE provides developers with such features as code completion for ease of development. It also lets you look under the hood of your application during the debugging process, allowing you to set breakpoints, step through code line by line, and view variable state information as illustrated in Figure 14.

 
Figure 14. Creation of Breakpoints and Variable Value Inspection

The simple Hello World application showcased in this article barely scratches the surface of the rich applications you can create for the BlackBerry. Being familiar with the BlackBerry JDE, you should now feel comfortable going through the numerous sample applications the JDE offers.



Kulvir Singh Bhogal works as an IBM consultant, devising and implementing J2EE-centric solutions at customer sites across the nation.
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date