I have a listView created using DragSortListView library. I am able to check and unckeck rows created using a custom base adapter. I get the checked positions using getCheckedItemPositions() in my fragment code.
The issue is when I delete a particular row which is checked and add a new row then that new row is automatically checked. I want that row to get unchecked when it is deleted.
Here is what I have done inside getView() but it's not working.
holder.clearItem.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            items.remove(position);
            updateNoteAdapter(items);
            holder.container.setChecked(false); //row needs to be unchecked
        }
    });
items is the arraylist of items displayed in the list row.
holder.container is OneLineCheckableListItem class implementing Checkable.
public class OneLineCheckableListItem extends RelativeLayout implements Checkable{
public OneLineCheckableListItem(Context context, AttributeSet attrs){
    super(context, attrs);
}
private boolean checked;
@Override
public void setChecked(boolean checked) {
    this.checked = checked;
    ImageView iv = (ImageView) findViewById(R.id.SelectImageView);
    iv.setImageResource(checked ? R.drawable.ic_toggle_check_box : R.drawable.ic_toggle_check_box_outline_blank);
}
@Override
public boolean isChecked() {
    return checked;
}
@Override
public void toggle() {
    this.checked = !this.checked;
}
}
Is there anything I missed here? Any help is appreciated. Thanks.
 
    