title: Stop listening for more listener events
body: <p>I listen to <code>onGlobalLayoutListener</code> as shown in below code. I want to listen it only once.
  Once <code>onGlobalLayout()</code> is called I want to stop listening to it. </p>
  
  <p>I tried using <code>removeOnGlobalLayoutListener()</code> method but that gives warning that <strong>call required API level 16 (current min is 14)</strong>. </p>
  
  <p>I also tried using <code>removeGlobalOnLayoutListener</code>. But it is deprecated.</p>
  
  <p><strong>Code :</strong></p>
  
  <pre><code>searchWebView.getViewTreeObserver().addOnGlobalLayoutListener(
                          new OnGlobalLayoutListener() {
      @Override
      public void onGlobalLayout() {
  
          // Do something
          // Remove listener
      }
  });
  </code></pre>
  
  <p>How to remove <code>onGlobalLayoutListener</code>?</p>
  
  <p><strong>Edit :</strong></p>
  
  <p><img src="https://i.stack.imgur.com/DwPDN.png" alt="enter image description here"> </p>