Screens

The main component of a BlackBerry® device UI is the Screen object.

A BlackBerry device can have multiple screens open at the same time, but only one screen can be displayed at a time. The BlackBerry® Java® Virtual Machine maintains an ordered set of Screen objects in a display stack. The screen on the top of the stack is the active screen that the BlackBerry device user sees. When a BlackBerry device application displays a screen, it pushes the screen on the top of the stack. When a BlackBerry device application closes a screen, it pushes the screen off the top of the stack and displays the next screen on the stack, redrawing the screen as necessary.

Each screen can appear only once on the display stack. The BlackBerry JVM throws a runtime exception if a screen that the BlackBerry device application pushes on the stack already exists. A BlackBerry device application must push a screen off the display stack when the user finishes interacting with the screen so that the BlackBerry device application can use memory efficiently. You should use only a few modal screens at one time, because each screen uses a separate thread.

The UI APIs initialize simple Screen objects. After you create a screen, you can add fields and a menu, and display the screen to the user by pushing it on the display stack. You can change the BlackBerry device UI and implement new field types, as required. You can also add custom navigation.

The Screen class does not implement disambiguation, which is required for complex input methods, such as international keyboards. For the integration of the different input methods, you can extend the Field class or one of its subclasses. You should not use Screen objects for typing text.

Next topic: Screen classes

Was this information helpful? Send us your comments.