title: Animation not starting the first time even when started in Handler.post()
body: <p>I have a fragment where in <code>onCreateDialog()</code> I start a background thread, which eventually calls this method:</p>
  
  <pre><code>protected void showMessageWithProgressWhenEmpty(final String message) {
      handler.post(new Runnable() {
          textView.setText(message);
          textView.setCompoundDrawablesWithIntrinsicBounds(
              R.drawable.anim_spin_refresh, 0, 0, 0
          );
          AnimationDrawable anim = (AnimationDrawable)textView.getCompoundDrawables()[0];
          anim.start();
      }
  }
  </code></pre>
  
  <p>The <code>handler</code> is created in <code>onCreateDialog()</code>. Subsequent calls to <code>showMessageWithProgressWhenEmpty()</code> animate like intended. The first call to this method (the one that doesn't animate properly) happens within about 1 second of the call to <code>onCreateDialog()</code>.</p>
  
  <p>I have already seen answers that mention that animations won't work when started in <code>Activity.onCreate()</code>, which is why I'm <code>post</code>ing the call to the <code>handler</code>.</p>
  
  <p>What am I missing here?</p>