title: How to have a background thread update UI several times with delays between the updates?
body: <p>I want to have a thread that generates the level and then with the new information from the calculations to update the UI several times with delays between them. useHandler() is called in the onCreate of the MainActivity:</p>
  
  <pre><code>Handler mHandler;
  public void useHandler() {
      mHandler = new Handler();
      mHandler.postDelayed(mRunnable, 1000);
  }
  private Runnable mRunnable = new Runnable() {
  
      @Override
      public void run() {
          calculateLevel();
          updateUI();
          //delay
          try {
              Thread.sleep(1000);
          } catch (InterruptedException e) {
              e.printStackTrace();
          }
          updateUI2();
          try {
              Thread.sleep(1000);
          } catch (InterruptedException e) {
              e.printStackTrace();
          }
          updateUI3();
          //then start over again
          mHandler.postDelayed(mRunnable, 1000);
      }
  };
  </code></pre>
  
  <p>The problem with what I wrote is that it doesn't seem to update the UI when using:</p>
  
  <p>imageView.setBackgroundResource(R.drawable.Blah);</p>
  
  <p>I also don't know if this code runs on a separate thread. What's the best way to do all of this?</p>