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

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -