Android - Get item from listview with custom adapter through checkbox -
i have listview custom adapter (extends baseadapter).
it recieves list of objects have populate listview.
one of object's atribute boolean called "checked".
on method getview, atribute responsible checking or not checking checkbox on view.
everything working fine , when activity loads, listview itens apear on list of objects (which received database), checked , not checked.
but when check 1 of listview's checkbox, need update object , therefore it's value on database. problem is:
"how know item (object) have update checking checkbox?"
"don't have same name?"
i have listview.setonitemclicklistener(...) can object it's position, works when click on "row" of list view itself, not on checkbox... thought using check/uncheck checkbox... how that? can use position specific checkbox listview?
in end, thought best method use "listview.setonitemclicklistener(...)" check checkbox, once easier user check 1 item it's row tiny checkbox, can me the best way solve problem?
i'm sorry didn't post code, right can't access it.
take @ tutorial
you need add method in onclick of checkbox implemented activity. 1 way add abstract method adpater , make activity implement it. lets call oncheckboxclicked(int position)
Comments
Post a Comment