Create an indicator for the number of messages in a custom folder
1.
Import the following classes:
•
net.rim.blackberry.api.messagelist.ApplicationIndicatorRegistry
•
net.rim.device.api.system.EncodedImage
•
net.rim.blackberry.api.messagelist.ApplicationIcon
•
net.rim.blackberry.api.messagelist.ApplicationIndicator
2.
Store a reference to an
ApplicationIndicatorRegistry
in an
ApplicationIndicatorRegistry
variable.
ApplicationIndicatorRegistry reg =
ApplicationIndicatorRegistry.getInstance();
3.
To create an encoded image from an image, invoke
EncodedImage.getEncodedImageResource
using the
name of the image file as an argument. Save a reference to the encoded image in an
EncodedImage
variable.
EncodedImage image = EncodedImage.getEncodedImageResource( "clowds.gif" );
4.
To create an BlackBerry® device application icon based on the encoded image, create an instance of an
ApplicationIcon
using an
EncodedImage
as an argument.
ApplicationIcon icon = new ApplicationIcon( image );
5.
Use an icon with an application indicator.
ApplicationIndicator indicator = reg.register( icon, false, true);
6.
To retrieve the indicator that theBlackBerry device application registered, invoke
ApplicationIndicatorRegistry.getApplicationIndicator()
and store the return value in an
ApplicationIndicator
variable.
ApplicationIndicator AppIndicator = reg.getApplicationIndicator();
7.
To set the icon and value of an indicator, invoke
ApplicationIndicator.set()
.
AppIndicator.set( newIcon, newValue );
Hide an indicator for a custom folder
1.
Import the
net.rim.blackberry.api.messagelist.ApplicationIndicator
class.
2.
To temporarily hide the indicator, invoke
ApplicationIndicator.setVisible()
.
OldIndicator.setVisible( false );
Remove an indicator for a custom folder
1.
Import the
net.rim.blackberry.api.messagelist.ApplicationIndicatorRegistry
class.
Development Guide
Create an indicator for the number of messages in a custom folder
74