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

Posts: 146
Registered: ‎11-05-2008
My Device: Not Specified

messagelistener is not listening

Hi,I have write a sample code,where if we open last received message,the messagelisetener will be listened.

My code is

Folder folder = store.getFolder("Inbox") ;
Message[] msgList = folder.getMessages();
int msgSize = msgList.length;

But it's not listening.

public void changed(MessageEvent e)   
       System.out.println(e.getMessageChangeType()+"----MessageEvent ------------------");

This method has not invoked,when I m opened the message.

Actually at which point I m wrong.Please help me.

BlackBerry Development Advisor
Posts: 15,813
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: messagelistener is not listening

I recommend verifying that you are adding the MessageListner to the message you think you are.  There is no guarantee that the array of messages returned from the getMessages call will be sorted in chronological order.
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.