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.
09-29-2011 06:35 AM
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.
10-07-2011 12:39 PM
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.
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.
10-07-2011 09:35 PM
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.