Would you like to tell us how we are doing?

You bet No thanks

Sorry about the red box, but we really need you to update your browser. Read this excellent article if you're wondering why we are no longer supporting this browser version. Go to Browse Happy for browser suggestions and how to update.

Localization sample app

The localization sample application demonstrates how you can create an application that manages multiple regions and languages using separate resource files instead of hard-coding textual elements into your source code.

In the sample application, there is an object choice field that allows the user to select a country. When a BlackBerry device user selects the country, the resource file for the appropriate locale is accessed and displayed.

File name



This file defines the LocalizationDemo class , the LocalizationDemoScreen class, and the InfoScreen class.

The LocalizationDemo class extends the UiApplication class, and contains the following constructor and methods:

  • main(String[ ] args) : contains a new instance of the application named theApp, provides the entry point to the sample application, and starts the main thread using theApp.enterEventDispatcher( )
  • LocalizationDemo() : constructs a new LocalizationDemo object and pushes a LocalizationDemoScreen object on to the display stack

The LocalizationDemoScreen class extends the MainScreen class, and implements the LocalizationDemoResource and FieldChangeListener interfaces. It contains the following constructor and methods:

  • LocalizationDemoScreen() : initializes the screen by creating the RichTextField, SeparatorField, and LabelField objects
  • fieldChanged(Field field, int context) : implementation of the FieldChangeListener interface listens for a BlackBerry device user to select a locale and displays the menu when the ObjectChoiceField changes

The InfoScreen class extends MainScreen, implements LocalizationDemoResource and displays the information for the currently selected locale.

This sample features the following classes:


This class manages resource files to provide functionality that supports the internationalization of applications. The ResourceBundle class contains location-specific objects that you can load from the resource bundle that matches a BlackBerry device user's locale.

The sample application creates a UI that allows you to showcase the ResourceBundle class by selecting a specific location and then access relevant location information that is stored in the resource files.

Install the sample app

In the BlackBerry Java Development Environment, open the workspace that you want to add the sample application to.

In the Files pane, right-click < workspace_name >.

Click Add project to < workspace_name >.

In the Add project to < workspace_name > dialog box, browse to the localizationdemo folder. The default location of this folder is C:\Program Files\Research In Motion\BlackBerry JDE 5.0.0\samples\com\rim\samples\device\ui\localizationdemo.

Click the LocalizationDemo.jdp file.

Click Open.

The sample is also available in github.

Run the sample app

In the BlackBerry Java Development Environment, in the workspace that you added the LocalizationDemo project to, right-click LocalizationDemo.

Click Build project.

On the taskbar, click Start > Applications > Research In Motion > BlackBerry JDE 5.0.0 > Device Simulator.

On the Home screen of the BlackBerry Smartphone Simulator click All.

Click the Localization Demo icon.