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

Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.

Posts: 105
Registered: ‎05-22-2008
My Device: Not Specified

Folder Listener :- App seems to hang



OS 4.2 on BB 8800. 


I have a folder listener and in the messagesAdded() I check to see if the subject contains a keyboard.

If it does, I do some processing..


Now when I have > 500 messages in my mailbox, and reboot the device, my device seems to hang.


Does this method get called once for each message every time I reboot the device ? (My app is auto start, so

it registers very early as a folder listener)


I thought it should get called only for new messages, unless rebooting causes a messagAdded to be triggered

again for each message.



Has anyone else faced problems with this ?


Also over time, my device frequently crashes, if I start off with fewer messages in my inbox, and the size grows.

I am certain its due to the folder listener, but cant seem to find out why, as I just check the subject.





Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: Folder Listener :- App seems to hang

FolderListener.messagesAdded() is only called when a new message is added to the folder.




Posts: 120
Registered: ‎07-16-2008
My Device: 9000

Re: Folder Listener :- App seems to hang

1. Do you mean your application crashes or your whole device crashes?  Does in shut off or lock up? 

2. Is there anything in your event log such as a stack trace or a forced stack trace of every thread?

3. What happens to your memory usage over time?  Does your memory usage go way up before the app/device crashes? 

Kurt Zettel | Chief Architect | Metova
Posts: 105
Registered: ‎05-22-2008
My Device: Not Specified

Re: Folder Listener :- App seems to hang


The System E-mail application and messenger application seem to hang.

Sometimes, after staying on the icon for a while, I get a exception dialog, saying that the app is not responding


I then need to reboot in order to get e-mail working again.


Strangly, my Application seems to work.


In anycase, just adding a


if(true) { return }


to the top of my method (effectively not doing any processing at all) seems to have solved the problem.


But now I cant do any processing, so its not really a solution, but I have to axe a feature to get my app to be

more stable.


Again this problem seem to appear only when I have a very large number of messages in the system inbox.


I have not looked at the system logs (Alt LGLG) in detail, and dont know how to monitor my app memory.

Again, my app seems to work fine..... 




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

Re: Folder Listener :- App seems to hang

Processor intesive tasks should not be performed within a listener.  Instead, the application can create a new thread to perform this task allowing the listener to continue.  Failing to do so can cause the behaviour you describe.
Mark Sohm
BlackBerry Development Advisor

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