Send a notification when a custom folder changes

After your BlackBerry® device application adds custom messages to the message list, you must manage the messages. For example, a BlackBerry device user might open the application and delete a message there, or the application might synchronize with a server and get more messages to display in the message list.

To keep the message list synchronized with the custom messages in a custom folder, an application needs to be notified when a custom folder changes.

  1. Import the required classes and interfaces.
    import net.rim.blackberry.api.messagelist.*;
  2. Invoke ApplicationMessageFolder.fireElementAdded() to notify an application when a message is added to a custom folder.
    inboxFolder.fireElementAdded( newMessage );
  3. Invoke ApplicationMessageFolder.fireElementRemoved() to notify an application when a message is removed from a custom folder.
    inboxFolder.fireElementRemoved( deletedMessage );
  4. Invoke ApplicationMessageFolder.fireElementUpdated() to notify an application when a message in a custom folder is updated.
    inboxFolder.fireElementUpdated( updatedMessage );
  5. Invoke ApplicationMessageFolder.fireReset() to notify an application when more than one message in a custom folder changes.

Was this information helpful? Send us your comments.