Executes the specified delegate on its own thread asyncronously.
public static Thread createThread( Delegate callback )
public static Thread createThread( Delegate callback, int priority )
callback
A delegate that is called as the entry point to the thread.
priority
The priority level of the thread.
Returns a Thread object representing the new thread.
Calling the createThread method makes it unnecessary to design a class that implements java.lang.Runnable or extends java.lang.Thread. The second version of this method allows you to define a thread priority level for the new thread. You can pass any delegate to the createThread method or use the MethodInvoker class to call a method that contains no parameters.
The following example illustrates how to use the createThread method to start a new thread within an application.
public class MyForm extends Form { public MyForm() { initForm(); //Start the thread that counts to 2000 Application.createThread(new MethodInvoker (MyThread), Thread.NORM_PRIORITY); } /**This thread runs concurrently with form loading and counts to 2000*/ private void MyThread{ for (int i = 0; i <= 2000; i++){ System.out.println("The value is currently equal to " + i); } } //More Form Code Here }