android - The method getId() in the type View is not applicable for the arguments (int) -


i trying implement checkboxes list after selecte multiple checkboxes want store them in arraylist , after clicking button send them server. @ momenant getting following error in statement

the method getid() in type view not applicable arguments (int)

as wellas @ line cb = new checkbox(this);

the final local variable cb may have been assigned

how can fix that?

 private void createcheckboxlist(final arraylist<integer> items) {         //final checkbox cb;          final linearlayout ll = (linearlayout) findviewbyid(r.id.lila);         (int = 0; < items.size(); i++) {             checkbox cb = new checkbox(this);             cb.settext(items.get(i).tostring());             cb.setid(i);             ll.addview(cb);          }         button btn = new button(this);         btn.setlayoutparams(new linearlayout.layoutparams(500, 150));         btn.settext("submit");         ll.addview(btn);          btn.setonclicklistener(new view.onclicklistener() {              @override             public void onclick(view v) {                 (int : items) {                     if (cb.getid(i).ischecked()) {                      }                 }              }         });      } 

edit:

i have deleted final checkbox cb; , assign object in loop checkbox cb = new checkbox(this); getting in if statement error cb cannot resolved how can assign ride of error?

when assign checkbox class variable getting error the method getid() in type view not applicable arguments (int) in if statement.

final linearlayout ll = (linearlayout) findviewbyid(r.id.lila); (int = 0; < items.size(); i++) {       checkbox cb = new checkbox(this);       cb.settext(string.valueof(items.get(i)));       cb.setid(i);       ll.addview(cb);     } 

use rather


Comments