2.
Create a class with the fields and methods for the module.
3.
Compile the project into a .jad file.
4.
Include the .jad file with the .jad files for the UI module and the main part of the program.
Start the module for background processes or the module for the UI
1.
Import the
net.rim.blackberry.api.messagelist.ApplicationMessageFolderRegistry
class.
2.
Create a main method for the BlackBerry®device application.
public static void main( String[] args )
{
try {
3.
In the
main()
method, check if the value of the
args
parameter indicates that the BlackBerrydevice application should
start the daemon module.
if( args.length == 1 && args[ 0 ].equals( "daemon" ) ) {
4.
Create an instance of a class that contains the daemon functionality and items.
MLSampleDaemon daemon = new MLSampleDaemon();
5.
Obtain a reference to the
ApplicationMessageFolderRegistry
.
ApplicationMessageFolderRegistry reg =
ApplicationMessageFolderRegistry.getInstance();
6.
In the
main()
method, check if the value of the
args
parameter indicates that the BlackBerrydevice application should
start the UI module.
} else if( args.length == 1 && args[ 0 ].equals( "gui" ) ) {
7.
Create an instance of a class that contains the UI functionality and items.
MLSampleGui gui = new MLSampleGui();
8.
Display the UI for the BlackBerrydevice application .
gui.showGui();
9.
Add the application to the event dispatcher.
gui.enterEventDispatcher();
Create an icon for a custom message
You can associate an icon with a message. In the message list, the icon displays on the left side of a message.
1.
Import the following classes:
•
net.rim.device.api.system.EncodedImage
•
net.rim.blackberry.api.messagelist.ApplicationIcon
•
net.rim.blackberry.api.messagelist.ApplicationMessageFolderRegistry
Development Guide
Start the module for background processes or the module for the UI
71