title: Programatically unchecking items in a dialog on Android
body: <p>I am displaying a list with checkboxes in a dialog. The list looks something like-</p>
  
  <pre><code>Item 1
  
  Item 2
  
  All
  </code></pre>
  
  <p>with a checkbox beside each item. Now the requirements is-
  If Item 1 or Item 2 or both are already checked, and All is selected, Item 1 &amp; 2 should be unchecked.</p>
  
  <p>To accomplish this, I implemented DialogInterface.OnMultiChoiceClickListener 's onClick listener.</p>
  
  <pre><code>public void onClick(DialogInterface dialog, int which, boolean isChecked)
  {
    if(which == 2 &amp;&amp; isChecked)
    {
      ((AlertDialog)dialog).getListView().setItemChecked(0, false);
      ((AlertDialog)dialog).getListView().setItemChecked(1, false);
    }
  }
  </code></pre>
  
  <p>But this does not work. I even tried invalidating the listview by calling Invalidate() &amp; InvalidateViews(), but no success.</p>
  
  <p>Any help will be really appreciated.</p>
  
  <p>Thanks,</p>
  
  <p>Akshay</p>