I am displaying a list with checkboxes in a dialog. The list looks something like-
Item 1
Item 2
All
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 & 2 should be unchecked.
To accomplish this, I implemented DialogInterface.OnMultiChoiceClickListener 's onClick listener.
public void onClick(DialogInterface dialog, int which, boolean isChecked)
{
if(which == 2 && isChecked)
{
((AlertDialog)dialog).getListView().setItemChecked(0, false);
((AlertDialog)dialog).getListView().setItemChecked(1, false);
}
}
But this does not work. I even tried invalidating the listview by calling Invalidate() & InvalidateViews(), but no success.
Any help will be really appreciated.
Thanks,
Akshay