I have implemented the Alert dialogue with checkbox and item name, I am not using any custom adapter to show the list view.I am able to display the items with checked states successfully but my problem is when ever i scroll the alertbox some of checkbox are unchecked.Could please suggest me how can i resolve this issue. Please find the code for showing alert box with MultiChoiceItems.

  AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
        builder.setPositiveButton(android.R.string.ok, this)
        .setOnCancelListener(this)
          .setTitle("title")
                .setMultiChoiceItems(nameofItems, Checkedstates, listner);
                 mDialog = builder.create();
                  mDialog.show();
1

There are 1 answers

2
Rohit Patil On

When you scroll list it update the view using data list so if you want your back check status, you have to update data list as well. Update your data list by using DialogInterface OnMultiChoiceClickListener.

OnMultiChoiceClickListener() {
    @Override
    public void onClick(DialogInterface dialog, int which, boolean isChecked) {
        Checkedstates[which] = isChecked;    
    }
}