Help Center
Local Navigation
- Creating user interfaces
- Storing data
- Creating connections
- Managing applications
- Using custom messages and folders in the message list
- Creating a module for background processes
- Creating a module for the UI
- Create the module for background processes
- Start the module for background processes or the module for the UI
- Create an icon for a custom message
- Create a custom folder in the message list
- Send a notification when a custom folder changes
- Create an indicator for the number of messages in a custom folder
- Hide an indicator for a custom folder
- Remove an indicator for a custom folder
- Applications for push content
- Localizing BlackBerry device applications
- Controlling access to APIs and application data
- Testing a BlackBerry device application
- Packaging and distributing a BlackBerry Java Application
- Glossary
- Provide feedback
- Legal notice
BlackBerry Manuals & Help
>
Documentation for Developers
>
Java Development Guides and API Reference
>
Development Guide - BlackBerry Java Development Environment - 4.7.0
Create a custom folder in the message list
To be able to perform operations on custom messages, the BlackBerry® device application must register at least one custom folder.
- Import the following classes:
- Import the following interfaces:
- Create a class that implements the ApplicationMessage interface.
public class MLSampleMessage implements ApplicationMessage
- Obtain a reference to the ApplicationMessageFolderRegistry.
ApplicationMessageFolderRegistry reg = ApplicationMessageFolderRegistry.getInstance();
- Register an BlackBerrydevice application
folder for each collection of messages.
ReadableList inboxMessages = messages.getInboxMessages(); // collection with MLSampleMessage elements ReadableList deletedMessages = messages.getDeletedMessages(); // collection with MLSampleMessage elements ApplicationMessageFolder inboxFolder = reg.registerFolder( INBOX_FOLDER_ID, "Inbox", inboxMessages ); ApplicationMessageFolder deletedFolder = reg.registerFolder( DELETED_FOLDER_ID, "Deleted Messages", deletedMessages, false );
- Let an BlackBerrydevice application
be notified when specific folder events occur.
deletedFolder.addListener( this , ApplicationMessageFolderListener.MESSAGE_DELETED );
- Create a class that implements the ApplicationMessageFolderListener interface.
public class AppFolderListener implements ApplicationMessageFolderListener
- To let an BlackBerrydevice application
perform actions when a folder event occurs, implement the actionPerformed() method of the ApplicationMessageFolderListener interface.
public void actionPerformed( int action, ApplicationMessage[] messages, ApplicationMessageFolder folder ) { // check if action was performed on multiple messages if( messages.length == 1 ) { switch( action ) { case ApplicationMessageFolderListener.MESSAGE_DELETED: messageStore.deleteInboxMessage( message ); - Set the root folder for the folders of the BlackBerry device application. The name of the root folder appears in the View Folder dialog of the Message list application when a BlackBerry device application
registers more than one application message folder.
reg.setRootFolderName( "ML Sample" );
Parent topic: Using custom messages and folders in the message list