Before you begin

You should have the following things ready:

  • The BlackBerry 10 Native SDK
  • Your BlackBerry 10 device
  • A basic understanding of the C language and some experience running applications with the native SDK

If you need more information, have a look at Getting Started with the NDK and Build and test your app.

Create your project

To get the Good Citizen application up and running, you need to create the appropriate project:

  1. In the QNX Momentics IDE, on the File menu, click New > Example.
  2. Click BlackBerry Example Project. Click Next.
  3. Select BlackBerry 10 OS Example Good Citizen Project. Click Next.
  4. Verify that you'd like to create the project in the default workspace, or clear the Use default location check box and select a different location for the project.
  5. Click Finish.

The project appears in the Project Explorer window in the IDE. To see the source files in the project, you can expand the project folder and then the src folder.

Using the application

In the Good Citizen example application, users control the color of the cube that appears on the screen by using the color menu. Users can interact with the application by tapping the radio buttons that appear to the left of the text. The current color of the cube is indicated by the radio button that is selected. The radio buttons are displayed using one of two .png files located in the project directory; one file shows a selected button and the other shows an unselected button. The background also uses a .png file that includes a shadow for the cube. These image assets are specified using the bar-descriptor.xml file in the project.

Action

Result

Swipe down from the top of the bezel.

The color menu appears on the screen.

Tap the radio buttons on the screen.

The color of the rotating cube changes and the selected radio button is highlighted.

Tap anywhere outside the radio buttons.

If the color menu is displayed, it will disappear.