Developers
Local Navigation
Exercise
Modify an application to support localization.
Prerequisite: You should complete the lab entitled Creating a User Interface before you start this exercise.
Objectives
- Discover how to create string resources in the IDE.
- Discover how to use resources in your code.
Setup
- Download the file (ZIP)
- In the IDE, open the cityinfob.jdw workspace
- Open the CityInfoB.java source file.
Tasks
- Add a resource header (.rrh) file to the cityinfob project.
- Add a resource content (.rrc) file to the cityinfob project.
- Add resources for each text string that is used in the application. Refer to the text file included in the cityinfob project for a list.
- Open the CityInfoB.java source file.
- Import the necessary package for localization.
- Add code to retrieve a ResourceBundle.
- Replace string literals by retrieving the appropriate resource.
Check Your Work
Download the completed code (ZIP)
Review
In this exercise, you discovered the following things:
- how to work with the IDE resource editor to create language resources
- how to use language resources in application code
Additional Labs
Go to the next exercise in “The Basics of Developing for BlackBerry”, Storing Persistent Data