title: Show an Alertdialog on Checkbox click
body: <p>I have a checkbox that can be either checked or unchecked. When the checkbox is checked and the user clicks it I want to display an AlertDialog without unchecking the checkbox (because when you click on the checkbox it becomes unchecked as it just follows the status change). In the AlertDialog I want to ask the user if they really want to uncheck it, and only then set the checkbox unchecked.</p>
  
  <p>I am not providing any more code as it is not necessary. I need guidance.</p>
  
  <pre><code>cb.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
  
      @Override
      public void onCheckedChanged(CompoundButton buttonView,boolean isChecked) {
  
          if (isChecked) {
  
          } else {
  
          }
      }
  }); 
  </code></pre>
  
  <p>Please do not add any solutions that adds the dialog in the <code>if (isChecked) {}</code> block, as per the documentation:</p>
  
  <blockquote>
    <p>A button with two states, checked and unchecked. When the button is
    pressed or clicked, the state changes automatically.</p>
  </blockquote>
  
  <p>This means the listener runs AFTER the checkbox's state as changed so it's too late to display a dialog then.</p>