The below code should be of some help:
ApplicationMessageFolderRegistry registry =
ApplicationMessageFolderRegistry.getInstance();
ApplicationMessageFolder inbox =
registry.getApplicationFolder(MessageListHelper.YOUR_CUSTOM_INBOX_FOLDER_ID);
ApplicationDescriptor daemonDescr =
ApplicationDescriptor.currentApplicationDescriptor();
Get existing messages from storage and register them in folders.
MessageStore messages = MessageListHelper.getMessageStore();
ApplicationMessageFolder inbox =
registry.registerFolder(MessageListHelper.YOUR_CUSTOM_INBOX_FOLDER_ID,
"Inbox", messages.getInboxMessages());
Register ourselves as a listener for callback notifications.
inbox.addListener(this, ApplicationMessageFolderListener.MESSAGE_DELETED |
ApplicationMessageFolderListener.MESSAGE_MARKED_OPENED |
ApplicationMessageFolderListener.MESSAGE_MARKED_UNOPENED, daemonDescr);
messages.setFolders(inbox);
registry.setRootFolderName(MessageListHelper.ROOT_FOLDER_NAME);
i just get the feeling while adding listener to the inbox, you may be missing out on the the options you are setting like
ApplicationMessageFolderListener.MESSAGE_DELETED |
ApplicationMessageFolderListener.MESSAGE_MARKED_OPENED |
ApplicationMessageFolderListener.MESSAGE_MARKED_UNOPENED
so, actionPerformed()
is getting called only for the first time to mark it old or something.