Add class-level declarations for _nameEditField and _nameListField, and then define a MenuItem with a run method (empty for now). These declarations belong next to the declarations of _statusLabel and _da.

Insert the following code below the private DataAccess _da; statement:

Update the run method in the HomeScreen class so that it calls the onAddToList method.

Replace the line of code that states \\ TODO with the following code snippet:

onAddToList();

Click File » Save All.

Run the simulator to verify that the application compiles and runs.

In the Package Explorer window, click Application.java, and then click Run » Run As » BlackBerry Simulator.

Note

If multiple projects are open in your workspace, click Run » Run Configurations, select HelloBlackBerry, and then click Run.

The HelloBlackBerry project compiles and then the simulator window appears.

Ensure that the project compiles without errors by selecting the Problems tab in Eclipse.

From the simulator menu, click File » Load Java Program.

Browse to the \UltraLite\UltraLiteJ\BlackBerry4.2\ directory of your SQL Anywhere installation and open the UltraLiteJ12.cod file.

Note

You may need to copy UltraLiteJ12.cod and the DBG files to the working simulator directory (for example, C:\Eclipse\plugins\net.rim.ejde.componentpack6.0.0_6.0.0.0.26\components\simulator\) to run the application. When copied, you do not need to load the Java program from the simulator menu.

From the simulator menu, click Simulate » Set IT Policy.

The Set IT Policy window appears.

In the Policy field, click Allow Third Party Apps To Use Persistent Store » >>.

Click Set and then click Close.

Launch your application.

In the simulator window, navigate to Downloads and then run the HelloBlackBerry application.

A screen appears that displays the Hello BlackBerry title bar, the Status: Connected text, and a Name field.

At the name field, type John Smith.

Click *EMPTY* and then choose Add.

John Smith appears in the list, which indicates that the name entry was added to the Names table in the database.

Names are stored in the database as you add them. They are retrieved from the database and added to the list when you close
and re-open the application.