我已经在alertdialog.builder里面的listview上创建了我想在取消按钮后取消选中所有复选框但是对我来说它没有清除,也没有给出复选复选框的位置我不知道怎么做。
mProgressDialog.dismiss();
Log.w("count0", ""+mAlCategoryNames.size());
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setAdapter(new CategoryAdapter(getApplicationContext(),R.layout.categorylist,R.id.xTvCategoryName, mAlCategoryNames, Home.this, getLayoutInflater()), null);
builder.setTitle("CHOOSE CATEGORIES");
builder.setNegativeButton("Cancel",
new DialogInterface.OnClickListener() {
public void onClick(
DialogInterface dialog,
int which) {
Log.w("Cancel",""+"Called");
Set<SavingCheckBoxState> keys=CategoryAdapter.mCheckMaps.keySet();
//checkAll(false);
// selected[which] = false;
((AlertDialog) dialog).getListView().setItemChecked(which, false);
ListView list =((AlertDialog) dialog).getListView();
int size = list.getCount();
}
});
builder.setPositiveButton("Add",
new DialogInterface.OnClickListener() {
public void onClick(
DialogInterface dialog,
int which) {
mAlFilterCategory.clear();
Set<SavingCheckBoxState> keys = CategoryAdapter.mCheckMaps
.keySet();
mAlFilterCategory = new ArrayList<String>();
if (keys.size() > 0) {
Iterator<SavingCheckBoxState> it = keys.iterator();
mCategory_Name=it.toString();
while (it.hasNext()) {
SavingCheckBoxState data = it.next();
if (data.isSelected()) {
Log.w("category name", data.getmCatgegoryName());
mAlFilterCategory.add(data.getmCatgegoryName());
}
}
}
}
});
builder.show();