Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Highlighted
Contributor
Posts: 10
Registered: ‎02-14-2013
My Device: BlackBerry Bold 9700
My Carrier: Vodafone

Problems when clicking on a notification from the status bar

[ Edited ]

Hi to all,
first I want to thank any answer, im too lost here and any information is welcome.

My problem is related to the notifications on the status bar.

With the following code:

    ApplicationDescriptor daemonDescr = ApplicationDescriptor.currentApplicationDescriptor();
    ApplicationDescriptor mainDescr = new ApplicationDescriptor(daemonDescr, FOLDER_NAME, new String[] {});
    ApplicationFolderIntegrationConfig config = new ApplicationFolderIntegrationConfig(true, true, mainDescr);

    ApplicationMessageFolder folder = ApplicationMessageFolderRegistry.getInstance().registerFolder(FOLDER_NAME_ID, FOLDER_NAME,new ReadableListImpl(),config);
    

//PushLibFactory.getApplicationMessageFolderListener() is only a simple ApplicationMessageFolderListener implementation


    folder.addListener(PushLibFactory.getApplicationMessageFolderListener(), ApplicationMessageFolderListener.MESSAGES_MARKED_OLD , mainDescr);
    folder.addListener(PushLibFactory.getApplicationMessageFolderListener(), ApplicationMessageFolderListener.MESSAGE_MARKED_OPENED , mainDescr);
    folder.addListener(PushLibFactory.getApplicationMessageFolderListener(), ApplicationMessageFolderListener.MESSAGE_DELETED , mainDescr);
    folder.addListener(PushLibFactory.getApplicationMessageFolderListener(), ApplicationMessageFolderListener.MESSAGE_MARKED_UNOPENED , mainDescr);

    // MessageNotificationStatusBar is a simple ApplicationMessage implementation
    MessageNotificationStatusBar message = new MessageNotificationStatusBar("", TEXT, BODY, TIME_RECEIVED);
    
    folder.fireElementAdded(message,true);

I'm able to create a group of notifications in the status bar like Twitter in the following example:

Example

And I'm able to receive the callback when user click on a message:

public void actionPerformed(int action, ApplicationMessage[] messages, ApplicationMessageFolder folder) {                              
                // DO SOMETHING
}

But, here are my questions:

1. How I can know about what notification is clicked?

    Debugging see funny things like this:
        * action is always 8
        * messages is always null
        * and seeing inside folder, in _cachedItems properly mark the atribute _new = false on the item I clicked, but not in the _originalItems (and these are the elements that the method getMessages() returns to me ).
          That is, the _cachedItems are updated correctly but the _originalItems no.
      
2. Can anyone tell me why?


Be grateful for any kind of help.
Regards.