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 apps with the Native SDK

This tutorial walks you through the Good Citizen application and explains the purpose of each section of code. You don't need to type any code yourself; it's all included in the main.c file of the Good Citizen project.

Create your project

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

  1. In the Momentics IDE for BlackBerry, 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.

After you've created the Good Citizen project, you can build and run the application to see what it looks like in action.

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 determined by which radio button 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.

Last modified: 2015-03-31



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus