title: AsyncTask vs Activity.runOnUiThread() vs Handler.post()
body: <p>I'm studying the code of a large app. There are 3 asynchrony patterns used in the UI, all of them seem equivalent:</p>
  
  <p><strong>Pattern 1, AsyncTask</strong></p>
  
  <pre><code>new AsyncTask&lt;X, Void, Z&gt;() {  
      protected Boolean doInBackground(X... params) {  
          //background task  
      }  
  
      protected void onPostExecute(Z res) {  
          //UI callback  
      }  
  }.execute();
  </code></pre>
  
  <p><strong>Pattern 2, Activity.runOnUiThread(Runnable)</strong></p>
  
  <pre><code>new Thread() {  
      public void run() {  
          //background task  
  
          runOnUiThread(new Runnable() {  
              public void run() {  
                  //UI callback  
              }  
          });  
      }  
  }.start();
  </code></pre>
  
  <p><strong>Pattern 3, Handler.post(Runnable)</strong></p>
  
  <pre><code>new Thread() {  
      public void run() {  
          //background task  
  
          handler.post(new Runnable() {  
              public void run() {  
                  //UI callback  
              }  
          });  
      }  
  }.start();
  </code></pre>
  
  <p><strong>Questions:</strong></p>
  
  <ul>
  <li>Any difference between the 3 patterns that I'm missing? (Besides AsyncTask being run on a pre-existing thread pool with background priority.)</li>
  <li>Any cases where a particular pattern would be preferred?</li>
  </ul>