title: Android View.post(Runnable) - Running but not affecting UI
body: <p>I'm trying to add a view to the toolbar in my Android Activity.  The below "decorView" is a RelativeLayout child view of the actionbar/toolbar.</p>
  
  <p>Defining the Container:</p>
  
  <pre><code>    ActionBar actionBar = getSupportActionBar();
  
      if (actionBar == null) {
          Toolbar toolBar = (Toolbar) findViewById(R.id.action_bar);
          setSupportActionBar(toolBar);
      }
  
      actionBar = getSupportActionBar();
  
      if (actionBar != null) {
          actionBar.setCustomView(getActionBarLayoutResourceId());
          this.mActionBarView = (RelativeLayout) actionBar.getCustomView()
                  .findViewById(R.id.relative_layout_action_bar);
          actionBar.setDisplayShowCustomEnabled(true);
          actionBar.setDisplayShowTitleEnabled(false);
          actionBar.setHomeButtonEnabled(false);
          actionBar.setDisplayUseLogoEnabled(false);
          actionBar.setDisplayShowHomeEnabled(false);
          actionBar.setDisplayHomeAsUpEnabled(false);
      } else {
          log("ActionBar is null");
      }
  </code></pre>
  
  <p>Adding the view:</p>
  
  <pre><code>final ViewGroup decorView = this.mActionBarView;
  
  Runnable postDecorHeaderView = new Runnable() {
          @Override
          public void run() {
              if (decorView.getWindowToken() != null) {
                  // The Decor dView has a Window Token, so we can add the
                  // HeaderView!
                  decorView.addView(mHeaderView);
              } else {
                  try {
                      Thread.sleep(1000); // 1 second
                  } catch (InterruptedException e) {
                      log(e.getClass() + ": " + e.getMessage());
                  }
                  // The Decor View doesn't have a Window Token yet, post
                  // ourselves again...
                  decorView.post(this);
              }
          }
      };
  
      decorView.post(postDecorHeaderView);
  </code></pre>
  
  <p>I have verified that decorView's child count increases after this method completes.  Unfortunately, my "mHeaderView" does not show up, nor does it appear in view hierarchy analysis.  I have tried other UI updates like changing a TextView's text to no avail.</p>
  
  <p>I have verified the identity of the decorView from within the runnable.  If I log the runnable, I see it running, I verify that it's running on the main UI thread... but no visual updates occur.</p>