mardi 1 août 2017

Checkboxes become unchecked in Dialog when scrolling

I am using AlertDialog.Builder.setMultiChoiceItems to show checkboxes with texts. I can display the checked items successfully, but whenever I scroll down or up, some of them become randomly unchecked. Bellow is my code.

What can I do to fix this? Any help appreciated!

AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle("Title")
    .setMultiChoiceItems(items, selectedItems,
            new DialogInterface.OnMultiChoiceClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which,
                                    boolean isChecked) {
                }
            })
    .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int id) {
            dialog.dismiss();
        }
    })
    .setNegativeButton(R.string.preklici, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int id) {
        }
    });




Aucun commentaire:

Enregistrer un commentaire