java - Checkbox not true when checked for every panel in my recyclerview? -
so created recyclerview , inflating xml file recyclerview, inside customxml file have checkbox, however, when click on checkbox gives me true statement first panel in recyclerview , rest false whats that?
public void checkbox(view view) { final checkbox checkbox = (checkbox) findviewbyid(r.id.checkbox); if (checkbox.ischecked()) { system.out.println("set checked"); } else{ system.out.println("set unchecked"); } }
note in recyclerview, multiple child views have same id. suspect final checkbox checkbox = (checkbox) findviewbyid(r.id.checkbox); not return checkbox want. sounds returns first 1 in list, not 1 clicked on. since checkbox() onclick listener checkboxes, there no reason call findviewbyid(). can use view sent parameter:
checkbox checkbox = (checkbox)view;
Comments
Post a Comment