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.

Trusted Contributor
Posts: 154
Registered: ‎02-15-2011
My Device: Not Specified

difference between invokelater and implementing Runnable when creating a new Thread

When creating a new thread in order to not hold up the event dispatcher it is required to spawn threads (I could be corrected on this statement).


Is there a difference beween using invokeLater and using the pure "java" way of creating a new thread, i.e implementing Runnable interface.



Posts: 172
Registered: ‎06-07-2010
My Device: BlackBerry 8520
My Carrier: Rogers

Re: difference between invokelater and implementing Runnable when creating a new Thread

Hello Andrian,


How are you doing? I hope all is well.


I hope you have found the answers to your question, but if not:


The main difference between invokeLater(new Runnable) and new Runnable is that invokeLater puts an action into the event queue. So that whenever the main event tasks are completed, the new Runnable will get processed.


A new Runnable() is an interface that will be executed whenever its called regardless if its on the main event thread. You can create a new thread to put a runnable in so that a new thread can be spawned.


For example:


Thread th = new Thread(myRunnable);



spawns off a new thread.



Let me know if you have any further questions or doubts, and I will be glad to answer them for you.




Raihan Masroor
BlackBerry Development Advisor
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: difference between invokelater and implementing Runnable when creating a new Thread

Just adding a little to the previous answer, which I hope helps.


invokeLater does not create a new Thread,  it just schedules a Runnable to be executed on the Event Thread.  This is the correct approach if you want to update the UI, since that needs to run on the Event Thread (or to be completely accurate, needs to run with the Event Lock). 


However if you have some long running background processing, or some blocking operation (like network interaction), then you really want to run this in your own Thread,- if you try to use the Event Thread, you will be blocking the User interactions.


So the two are not different ways to do the same thing.  You will choose one way or the other depending on what you are trying to achieve. 


Review this for more informaiton:



Do a search for Event Thread - there are other interesting KB articles too.