identify the ending of a thread
java.lang.Threads
A thread is finished, when the run()-method was left.
// start a thread: Thread thread = new MyThread(); thread.start(); // call up, if the thread is still running: if (thread.isAlive()) { // thread is still running... } else { // thread is finished } // wait a stated time for the ending of a thread: long waitMillis = 10000; // 10 seconds try { thread.join(waitMillis); if (thread.isAlive()) { // The 10 seconds are over sind um; the thread is still running } else { // Thread is finished } } catch (InterruptedException e) { // The thread was stopped } // Wait until the thread is finished: finish try { thread.join(); // This Code will be worn out when the thread is ready. } catch (InterruptedException e) { // Thread was stopped }