android - Using a CustomAdapter in a ListView, I need to manually check/uncheck the CheckBox. How do I do this? -


i feel question posted thousand times. there several cases close answer, slips through fingers.

what want is, when click in row of list, manually un/check checkbox of row.

in others words: when click in listview row, have obtain checkbox object associated can change value of it.

i feel answer calling or reproducing holder.checkbox.setonclicklistener (which handles checkbox state inside customadapter) method inside listview.setonitemclicklistener method, don't know how :(

just clear - can row clicked, checkbox clicked, position , every data it. if click checkbox, gets checked no problem. thing can't check box when click text next box.

i can post code if requested, i'm not sure if it's necessary i'll avoid making question wall of text.

listview mylistview  = (your listview); mylistview.setonitemclicklistener(new onitemclicklistener() {          @override         public void onitemclick(adapterview<?> arg0, view arg1, int arg2,                 long arg3) {             viewgroup currentitem = (viewgroup)mylistview.getchidat(arg2);                     (checkbox) currentcheckbox = currentitem.findviewbyid(---id of checkbox ); currentcheckbox.setchecked(true);         }     }); 

Comments