mercredi 4 avril 2018

Android set all checkboxes to uncheked state on RecyclerView from another activity

I have an activity, Start.java and CandidateAdapter.java class who extends RecyclerView.Adapter<CandidateAdapter.MyViewHolder>.

On CandidateAdapter.java, I have a list of names with a checkbox for each name.

On Start.java when I push "save" button, I send with LocalBroadcast the value "false" to CandidateAdapter.java so that, after saving the state of each checkbox to a database I can uncheck all checkboxes.

I wrote on a onBindViewHolder method of CandidateAdapter.java, this code to achieve this:

if (!checkBoxStatus) holder.voteCheck.setChecked(false);

But its not working. The code holder.voteCheck.setChecked(false) is not getting executed. Maybe because the onBindViewHolder method executed when loads for one time and with listeners I think...

Is it possible to set all checkboxes to uncheked state? I can send my code if is necessary.

Aucun commentaire:

Enregistrer un commentaire