title: confused about viewTreeObserver.addOnGlobalLayoutListener usage
body: <p>I am altering a recyclerview and would like to be notified of when that update is finished.  I read <a href="https://stackoverflow.com/questions/30397460/how-to-know-when-the-recyclerview-has-finished-laying-down-the-items">How to know when the RecyclerView has finished laying down the items?</a> that you are notified in the callback to addOnGlobalLayoutListener, but that is called too many times unless you add the last line.</p>
  
  <p>Here is what I tried:</p>
  
  <pre><code>my_rv.viewTreeObserver.addOnGlobalLayoutListener {
       calculate(myAdapter.getItems())
       my_rv.viewTreeObserver.removeOnGlobalLayoutListener(this)
  }
  </code></pre>
  
  <p>in order for the last line to compile, my fragment needs to override onGlobalLayout.  What am I supposed to put in onGlobalLayout?  I never see that callback even called.</p>