title: Run terminated thread java android
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/5411509/terminated-thread-revival">Terminated Thread Revival</a>  </p>
  </blockquote>
  
  
  
  <pre><code> Thread threadWait = new Thread()
      {
          @Override
          public void run() {
              try {
                  sleep(10000);
                  sync = false;
              } catch (InterruptedException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              }
          }               
      };
  </code></pre>
  
  <p>I call this thread here:</p>
  
  <pre><code>            threadWait.start();
          while(sync){
          //do something
          }
  </code></pre>
  
  <p>when threadWait finished the state is TERMINATED. How i can start the thread another time? Any idea? THX TO ALL!</p>
  
  <p>SOLUTION:</p>
  
  <pre><code>Runnable runWait = new Runnable(){
      public void run(){
          try {
              Thread.sleep(10000);
              sync = false;
          } catch (InterruptedException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
  
      }
  };
  </code></pre>
  
  <p>and..</p>
  
  <pre><code>Thread first = new Thread(runWait);
              first.start();
  </code></pre>