android - How to load and save checkbox values in a listview -
i have listview full of text, each row has got checkbox. when oncreate()
called want load checkbox values sharedpreferences
, apply them checkboxes. when onpaused()
called, want save checkbox values.
anyone got idea how that???
p.s. have been reading stuff little , have found custom adapters
don't quite point of them. if can explain me that, appreciated.
when extending custom adapter
, you're precisely implementing stuff described. in case, seems arrayadapter
enough achieve it.
this adapter has getview()
method called each of rows, , processes rows , you implement how should shown. method has 3 parameters, first 1 position
of row being rendered. second 1 view
that, vaguely talking, represents layout of entire row. third 1 represents parent of view
. way, assuming second parameter called convertview
, can like:
checkbox cb = convertview.findviewbyid(r.id.mycheckbox);
and set call cb.ischecked(...)
appropriate value show current's row value checkbox.
some useful links:
Comments
Post a Comment