BlackBerry
Skip Top Navigation
Developers Partners
North America [change region] Products Solutions Purchasing Support
Developers


Writing Your First Application

Exercise

Write a basic application for a BlackBerry® device that displays the message “Hello World!” to users.

Objectives

  • Discover how to use the integrated development environment (IDE).
  • Discover how a BlackBerry application is organized.
  • Discover some of the basics of BlackBerry user interface APIs.

Setup

  1. Download the file
  2. In the IDE, open the helloworld.jdw workspace
  3. Open the helloworld.java source file.

Tasks

  1. Add code to the main() method to start the application.
  2. Define a constructor for your application to display HelloWorldScreen.
  3. Add code to the HelloWorldScreen inner class to set the title for the screen, for example, “HelloWorld Sample”.
  4. Add code to display the text “Hello World!”
  5. Add code to the onClose() method to display a dialog box with the text “Goodbye!” when the user closes your application.

Check Your Work

Download the completed code

Review

In this exercise, you discovered the following things:

  • how to write, compile, and run applications in the IDE
  • how to start an application
  • how to create a screen and add a title and text fields to it
  • how to define an action when the user closes an application


Additional Labs

Go to the Next Exercise in “The Basics of Developing for BlackBerry”, Creating a user interface

Back to the Developer Lab Main Menu

 
Other Resources
 
     
 Home | Products | Solutions | Purchasing | Support | Developers | Worldwide | News | About Us | Contact Us | Site Map
 Legal | Copyright © 2008 Research In Motion Limited, unless otherwise noted.