On a BlackBerry, the indication panel at the top of the display can be used to display alerts to the user.
Typically this is used to display status changes such as new email messages, new facebook messages or new news feed items etc.
Since OS 4.6, BlackBerrys have had the ability to easily add entries to the notification area. The image on the left shows a BlackBerry Torch with 2 indicators.
To add an indicator into the notification area, requires that an icon be loaded and stored in the ApplicationIndicatorRegistry and then displayed with an optional numeric value next to it.
To register the indicator icon, use the following code:
This piece of code loads the image indicator.png from the application and stores it in the ApplicationIndicatorRegistry. The parameters to the register() method are:
- The ApplicationIcon to register
- Boolean flag indicating whether to display an icon only or whether to display a numeric value alongside the icon.
- Boolean flag indicating whether the application indicator is visible when first created.
Once the icon has been loaded and stored in the registry, it can be updated easily in the notification area:
I recently posted
on how to programatically set the background color using Java within a BlackBerry app.
This technique works fine if you are using Field Managers to add components on to the screen.
If however, your user interface is drawn within the paint(Graphics g) mehod, this technique does not work. In this case, you need to override the paintBackground(Graphics g) method to set the background color.
Setting the background color on a BlackBerry screen is fairly easy. Since JDE 4.6.0, the BackgroundFactory class can be used to accomplish this.