( INBOX_FOLDER_ID, "Inbox", inboxMessages );
ApplicationMessageFolder deletedFolder = reg.registerFolder
( DELETED_FOLDER_ID, "Deleted Messages",
deletedMessages, false );
6.
Let an BlackBerrydevice application be notified when specific folder events occur.
deletedFolder.addListener( this ,
ApplicationMessageFolderListener.MESSAGE_DELETED );
7.
Create a class that implements the
ApplicationMessageFolderListener
interface.
public class AppFolderListener implements ApplicationMessageFolderListener
8.
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 );
9.
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" );
Send a notification when a custom folder changes
1.
Import the
net.rim.blackberry.api.messagelist.ApplicationMessageFolder
class.
2.
To notify a BlackBerry® device application when a message is added to a custom folder, invoke
ApplicationMessageFolder.fireElementAdded()
.
inboxFolder.fireElementAdded( newMessage );
3.
To notify a BlackBerry device application when a message is removed from a custom folder, invoke
ApplicationMessageFolder.fireElementRemoved()
.
inboxFolder.fireElementRemoved( deletedMessage );
4.
To notify a BlackBerry device application when a message in a custom folder is updated, invoke
ApplicationMessageFolder.fireElementUpdated()
.
inboxFolder.fireElementUpdated( updatedMessage );
5.
To notify a BlackBerry device application when more than one message in a custom folder changes, invoke
ApplicationMessageFolder.fireReset()
.
inboxFolder.fireReset();
Development Guide
Send a notification when a custom folder changes
73