lundi 4 juillet 2016

Checkbox holder using setOnCheckedChangeListener

I'm trying to make a listview with checkboxes, I have tried a code and it worked correctly but I faced a problem when trying to merge this code with my code. The problem appears in this line of code

holder.chkBox.setOnCheckedChangeListener((MyActivity) context);

because the code I have tried is using Adapter.java file separated from the MainActivity.java file, but in my code all are in one file so I don't know how to use this line in my code, I have tried this

holder.chkBox.setOnCheckedChangeListener((this) context);

but also a wrong statement

The reason of using this line of holder is that when I checked a checkbox and slide down through the others items, the checked checkbox is automatically unchecked, Could anyone tell me how to fix this problem?




Aucun commentaire:

Enregistrer un commentaire