I'd like to clear selected items when the total came to three items selected, I am doing as follows but is not working ...
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(getResources().getText(R.string.escolhaArquivosBaixados));
builder.setMultiChoiceItems(items, selected, new DialogInterface.OnMultiChoiceClickListener() {
@Override
public void onClick(DialogInterface dialog, int which, boolean isChecked) {
//
int count = 0;
for(int i = 1; i < selected.length; i++){
//
if (selected[i]){
count++;
}
if (count == 3){
//enter here but nothing happens
((AlertDialog) dialog).getListView().setItemChecked(which, false);
break;
}
}
}
});