The best way to start the simulator and run the application is to click on the Run button on the toolbar. This button looks like the standard Play button that is commonly used in many IDEs. Of course, you can also use the Run menu item, which is found under the Run menu. Finally, like all good IDEs, there is a hotkey as well. In this case, pressing Ctrl + F11 will start the simulator to running.
At this point the BlackBerry simulator is
starting up. This should be pretty quick and when it is done you should
see a window with the picture of a BlackBerry Curve in it. You can
change the device being simulated, but because we are using the
BlackBerry 4.5 component pack, the curve simulator is shown by default.
Next, you need to find the HelloWorldDemo application. Click on the Menu button (or press the Insert key to simulate that) and use the arrow keys to simulate scrolling the trackball to select the HelloWorldDemo icon.
Next, press F9 to simulate clicking the trackball to start the application. Pressing the Enter key will also start the application, but not because pressing Enter simulates clicking the trackball. On a real handheld pressing the Enter
key will start the selected application because that is specifically
handled on the Home Screen. Therefore, in the simulator, pressing Enter also works to start the application.
It shouldn't take long for the application to start. When it does, you should see the following screenshot.
The HelloWorldDemo application has already done all it is intended to do. That task is to display the string Hello World!. As there isn't anything more to be done, let's just quit the application. Open the menu (by pressing the Insert key or by clicking on the Menu button) and select the Close menu item by pressing F9, or Enter. Now, press F9 or Enter again to dismiss the dialog that is shown.
Now,
the simulator should be back at the Home Screen just like it was when we
started. The last thing to do now is to quit the whole simulator
session. Either go to File | Exit or simply close the simulator window.
What just happened?
As you can see, using the simulator is both an easy
and effective way to see what your application will look like on a
device. The keyboard mappings are generally intuitive, but if you forget
the ones that aren't, you can always use the mouse to click on the
screen and simulate key presses. The simulator can do so much more than
just display the application for you.
Many of the features of the device can be controlled
using the various menu items that are available at the top of the
simulator application. For instance, navigating to Simulate | Incoming Voice Call
will display a small dialog where you can set information about the
incoming call and then actually initiate an incoming call in the
simulator. Of course, there is no way to communicate on the call, but
this can be used to test how your application might handle being
interrupted by an incoming phone call.
Another clever simulation feature is the ability to set the image that the camera will get when a picture is taken. Using Simulate | Camera Image,
you can browse to and select an image file. Later, when you use the
camera within the simulator and press the track wheel to take a picture,
the selected image will be displayed.
These are just a couple of the interesting tools that are available for simulating a real device as closely as possible.