What I want to do is if April and May have a due amount then a user cannot select May if April is not selected. First, a user has to select April then the May checkbox will get enabled. If May is selected then June will get enabled.
I am not able to get position of the checkboxes so that I can do the same.
@Override
public void onBindViewHolder(@NonNull FeeHolder holder, int position) {
holder.textView_fee.setText(Integer.toString(list.get(position).getFeeAmount()));
holder.textView_due.setText(Integer.toString(list.get(position).getDueAmount()));
holder.checkBox.setText(list.get(position).getInstallmentName());
holder.checkBox.setTag(Integer.toString(position));
arrayList.add(holder.checkBox);
/*if (holder.checkBox.isChecked()) {
arrayList.add(holder.checkBox);
}*/
holder.checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
}
});

Add a
selectedproperty (with getters and setters) to yourlistarray and here's a code fragment to play with.Then, on your
setOnCheckedChangeListener, update your object'sselectedproperty accordingly.PS: This applies a chain effect if previous items have
dueAmount > 0