title: sleeping in a thread without causing runOnUiThread to sleep
body: <p>I have a thread in my android app, this thread has to sleep for a certain time in order to waiting some results which will be set by the <code>runOnUiThread</code> thread, the problem is when i tried to make the thread sleeps for a portion of time the <code>runOnUiThread</code> sleeps with it too and so it doesn't perform any processing till the other thread wakes up although <code>runOnUiThread</code> is exists in another separated thread.</p>
  
  <p>that's my code:
  The thread that contains the <code>runOnUiThread</code> :</p>
  
  <pre><code>Thread xbmc = new Thread (){
              @Override
              public void run(){
                       System.out.println("one");// working perfectly
              runOnUiThread(new Runnable() {
              public void run() {
              try { 
                         System.out.println("two");// not work till the other thread wakes up
              } catch (Exception e) {
              }
          }
      });
     }
   };
           xbmc.start();
  </code></pre>
  
  <p>And this is the Thread that I make sleeps:</p>
  
  <pre><code>    display = false;
      Thread wait = new Thread(new Runnable() {
          @Override
          public void run() {
              int d = 0;
              while (d != 20) {
                  if (wake_up) {
                      display = true;
                      break;
                  }
                  try {
                      Thread.sleep(1000);
                  } catch (InterruptedException e) {
                      e.printStackTrace();
                  }
                  d++;
              }
  
              if (!display) {
                  display = true;
              }
          }
      });
      wait.start();
  
      while(!display){}// infinite loop waits for the thread to finish it's looks or something breaks it, and there is no something can break it but the `runOnUiThread` processing results
  </code></pre>