java - save checkbox value to sqlite database -
i have insert method on dbhelper class working , on mainactivity.java have:
if (mydb.insertitem(userinput.gettext().tostring(), userdesc.gettext().tostring(), checked)) { toast.maketext(getapplicationcontext(), "done", toast.length_short).show(); }
the third parameter on insert boolean value checkbox, problem how value on strings using sometext.gettext().tostring(). how work on booleans? please on adapter class have:
itemviewsholder.getcheckbox().setchecked( item.ischecked() ); itemviewsholder.cbdone.setonclicklistener( new view.onclicklistener() { public void onclick(view v) { checkbox cb = (checkbox) v ; items itm = (items) cb.gettag(); itm.setchecked( cb.ischecked() ); if(cb.ischecked()){ string s = itm.getname(); system.out.println(s); } } });
use instead of check:
string.valueof(checked);
Comments
Post a Comment