The following code leads to java.lang.IllegalThreadStateException: Thread already started when I called the start() method a second time in the program.
updateUI.join(); if (!updateUI.isAlive()) updateUI.start();
This happens when the second time updateUI.start() called. I went through it several times, and the thread is called and terminated before completion, before clicking updateUI.start() .
Calling updateUI.run() avoids the error, but causes the thread to start in the user interface thread (the calling thread, as indicated in other posts on SO), which is not what I want.
Is it possible to run Thread only once? If so, what do I do if I want to start the thread again? This particular thread does some calculations in the background, if I do not do this in the stream than in the UI thread, and the user has an unreasonably long wait.
java android multithreading
Will Aug 01 '09 at 1:15 2009-08-01 01:15
source share