title: How can I delay onClick action
body: <p>I am trying to do something in java app (android) and I need something to delay/wait for an amount of seconds for a loop. How can I do delay android function? I have tried to use Thread.sleep(), TimeUnit.sleep, but it is only going to do irresponsible program for some seconds. I want to do some onClick actionlistener which updating for some seconds.
  e.g: if I clicked to button -> Text is changed to random(int) and it's should be done per second. </p>
  
  <blockquote>
    <p>random ... waiting for a second ... random ... waiting for a second
    ... random ... and so many times</p>
  </blockquote>
  
  <pre><code>for (int i = 0; i &lt; 10; i++) {
      int random = r.nextInt(100) - 10;
      String rand = Integer.toString(random);
      textView3.setText(rand);
      TimeUnit.SECONDS.sleep(1);
  }
  </code></pre>