title: How to delay execution android
body: <p>I am building an android board game which features AI. The AI gets a turn and has to invoke a series of actions after which it posts invalidate to my custom view to update. </p>
  
  <p>I need to slow down these actions so the user gets to see the AI having its turn rather than it flashing by.</p>
  
  <p>I have tried something along these lines</p>
  
  <pre><code>    try {
          doFirstThing();
          Thread.sleep(500)
          //post invalidate
  
          doNextThing();
          Thread.sleep(1000)
          //post invalidate
       }
       catch (Exception e) {
       }
  </code></pre>
  
  <p>However this is having absolutely no effect. Also this is running in a separate thread if this wasn't obvious.</p>
  
  <p>Whats my best option I've looked at handler but they don't need right as i need to execute a series of tasks in sequence updating the view each time.</p>