12-22-2011 10:29 AM
When my app is launched, or resumes after a phone call etc... I would like to perform a few tasks in the activate() method. First I would like to start a new Thread to call a few web services, and when it's done I would like to update the UI.
I already tried to do this. I created a new class that extends Thread, in the run() method I placed all the relevant web service calling code, and in the activate() method of my main Thread I did:
MyThread myThread = new MyThread();
But I noticed that nothing seems to be getting done. So I simplified my code by removing all the web service calls from the run() method and replacing it with a wait(500) method, followed by a method call to update UI (in this case it just creates a new ButtonField, just for testing purposes).
But the ButtonField never gets created.
The new thread doesn't seem to be starting at all.
Thanks a lot.
Solved! Go to Solution.
12-23-2011 01:39 AM
Have you tried setting breakpoints or using println to trace the execution?
Firstly, is activate() even being called?
Second, is run() being reached?
When the thread does the UI work, if you've got that in a synchronized block try an invokeLater block instead.