title: What is the difference between View.postDelayed() and Handler.postDelayed() on the main thread?
body: <p>According to the documentation of <code>Handler.postDelayed(Runnable r, long delayMillis)</code>:</p>
  
  <blockquote>
    <p>Causes the Runnable r to be added to the message queue, to be run
    after the specified amount of time elapses. The runnable will be run
    on the thread to which this handler is attached.</p>
  </blockquote>
  
  <p>On the other hand <code>View.postDelayed(Runnable action, long delayMillis)</code>:</p>
  
  <blockquote>
    <p>Causes the Runnable to be added to the message queue, to be run after
    the specified amount of time elapses. The runnable will be run on the
    user interface thread.</p>
  </blockquote>
  
  <p>I want to know if there is a difference between the two while calling them from the main thread and in particular, if there is a difference when the activity is being destroyed?</p>
  
  <p>I have read this <a href="http://www.androiddesignpatterns.com/2013/01/inner-class-handler-memory-leak.html" rel="noreferrer">article</a> about how I might leak an Activity when I use an inner class Handler and I was wondering whether using <code>View.postDelayed()</code> would cause the same problem.</p>
  
  <p>For example could foo() cause an issue or would the destruction of the activity solve the fact that the <code>Runnable</code> anonymous class is holding a reference to the activity?</p>
  
  <pre><code>public class MyActiviy extends Activity {
      private void foo(View v) {
          v.postDelayed(new Runnable() {
              public void run() {
                  // some delayed work
              }
          }, 60000);
          finish();
      }
  }
  </code></pre>