Screens
The main structure for a BlackBerry® device user interface is the Screen object. A BlackBerry device application 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 Screen objects in a display stack. The display stack is an ordered set of Screen objects. The screen at 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 to the top of the stack. When a BlackBerry device application closes a screen, it removes the screen off the top of the stack and displays the next screen on the stack, redrawing it as necessary. Each screen can appear only once in the display stack. The BlackBerry JVM throws a runtime exception if a Screen that the BlackBerry device application pushes to the stack already exists. A BlackBerry device application must remove screens from the display stack when the BlackBerry device user finishes interacting with them so that the BlackBerry device application uses memory efficiently. Use only a few modal screens at one time, because each screen uses a separate thread.
The UI APIs initialize simple Screen objects. Once you create a screen, you can add fields and a menu to the screen, and display the screen to the BlackBerry device user by pushing it on to the display stack. The Menu object has associated menu items that are runnable objects that perform a specific task when the BlackBerry device user selects one of the items. For example, you can use menu items to invoke the necessary code to establish a network connection, commit a data object to memory, or close a BlackBerry device application. You can customize 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 seamless integration of the different input methods, extend the Field class or one of its subclasses. Do not use Screen objects for typing text.
For knowledge base articles about displaying and working with screens, visit the BlackBerry Developer Zone at www.blackberry.com/developers.
- Screen classes
- Create a screen
- How the BlackBerry JVM manages screens
- Providing screen navigation when using a MainScreen
- Manage a drawing area