-1
cbChecked.setOnCheckedChangeListener(new OnCheckedChangeListener() {

            @Override
            public void onCheckedChanged(CompoundButton buttonView,
                    boolean isChecked) {
                // TODO Auto-generated method stub
                FaxDialogActivity.record.get(position).isChecked = true;
            }
        });

but when i check the one checkbox, multiple checkboxes get selected after scrolling the listview.

Sadeshkumar Periyasamy
  • 4,848
  • 1
  • 26
  • 31

1 Answers1

0

This is because getview is called everytime the view recycles while scrolling a list view.So u have store a value and check it in getview to get checked checkbox.

Try this

1> Create an ArrayList of Boolean Object to store the state of the each CheckBox 2> Initializes the ArrayList items to default value false, means no CheckBox is checked yet. 3>When you click on CheckBox. Set a check against Checked/Unchecked state and store that value in ArrayList.

Now set that position to CheckBox using setChecked() method.

for complete code please refer THIS ANSWER and this BLOG

Community
  • 1
  • 1
Anirudh Sharma
  • 7,968
  • 13
  • 40
  • 42