Make use of the BlackBerry® Options framework to let the user customize a Hello World application.
- Discover how to define and register an OptionsProvider that exposes application configuration data.
- Open Options_1.zip
- In the IDE, open the options.jdw workspace
- Open the HelloWorld.java source file.
- Open the HelloWorldOptionsProvider.java source file.
- Open the HelloWorldProperties.java source file.
- 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.
- 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.
- Observe that the HelloWorld constructor's behavior differs depending on the values of the HelloWorldProperties.
- In the class HelloWorldOptionsProvider, define suitable UI controls for the greeting and greetingEmphasized properties as member variables.
- In the populateMainScreen method, instantiate those controls with initial values read from _properties.
- In the save method, write the user's input back to _properties.
- 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
In this exercise, you discovered the following things:
- to define and register an OptionsProvider that exposes application / configuration data.