Troubleshooting guide

Contents
1 Creating UIs .........................................................................................................................................................13
Elements of a BlackBerry device UI ..............................................................................................................13
Screens.......................................................................................................................................................13
UI components..........................................................................................................................................14
Create a screen ................................................................................................................................................15
Adding UI components to a screen...............................................................................................................15
Create UI components.............................................................................................................................15
Creating custom UI components................................................................................................................... 17
Create a custom field...............................................................................................................................18
Code sample: Creating custom buttons............................................................................................... 22
Create custom context menus...............................................................................................................26
Code sample: Creating a custom context menu................................................................................. 27
Create custom layout managers ...........................................................................................................29
Code sample: Creating a custom layout manager .............................................................................30
Create custom lists.................................................................................................................................. 33
Code sample: Creating a custom list....................................................................................................34
Adding menu items to BlackBerry applications.........................................................................................36
Create a menu item.................................................................................................................................36
Register a menu item..............................................................................................................................36
Code sample: Creating a new menu item in a BlackBerry application ........................................... 37
Arrange UI components.................................................................................................................................38
Define a layout manager........................................................................................................................40
Set field focus and navigation ......................................................................................................................40
Listen for field focus changes .......................................................................................................................40
Respond to UI events .....................................................................................................................................40
Listen for field property changes..................................................................................................................42
Manage foreground events ...........................................................................................................................43
Manage drawing areas...................................................................................................................................43
2 Using graphics and multimedia.......................................................................................................................45
Using images...................................................................................................................................................45
Use raw images........................................................................................................................................45
Use encoded images...............................................................................................................................46