Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Using the Options API

by Retired ‎02-12-2010 03:01 PM - edited ‎09-17-2010 04:25 PM (3,076 Views)

Exercise

 

Make use of the BlackBerry® Options framework to let the user customize a Hello World application.

 

Objective

 

  •  
    • Discover how to define and register an OptionsProvider that exposes application configuration data.

Setup

  1. Open Options_1.zip
  2. In the IDE, open the options.jdw workspace
  3. Open the HelloWorld.java source file.
  4. Open the HelloWorldOptionsProvider.java source file.
  5. Open the HelloWorldProperties.java source file.

Tasks

  1. Observe that there are two projects defining GUI and background entry points. See the “Communicating with other applications” exercise for details on multiple entry points.
  2. Observe that the class HelloWorldProperties defines a record type with the properties greeting and greetingEmphasized. The class persists one instance of itself, defining the Hello World application's current configuration. See the “Storing persistent data” exercise for details on persistence.
  3. Observe that the HelloWorld constructor's behavior differs depending on the values of the HelloWorldProperties.
  4. In the class HelloWorldOptionsProvider, define suitable UI controls for the greeting and greetingEmphasized properties as member variables.
  5. In the populateMainScreen method, instantiate those controls with initial values read from _properties.
  6. In the save method, write the user's input back to _properties.
  7. When the background entry point of the HelloWorld application is triggered, create a HelloWorldOptionsProvider and register that instance with the device's options manager.

Check Your Work

 

Check Options_2.zip

 

Review

 

In this exercise, you discovered the following things:

 

  •  
    • to define and register an OptionsProvider that exposes application / configuration data.
Contributors
Users Online
Currently online: 19 members 899 guests
Recent signins:
Please welcome our newest community members: