java - How do I instruct ArrayAdapter to redraw all its elements? -


i have list of items in (subclass of) arrayadapter, , when 1 of items in arrayadapter changed, need update view. (for context, bulk pricing model, more things buy, cheaper else gets, , want update price of when add cart)

from reading documentation, expected notifydatasetchanged() trick, isn't doing want. should doing?

as requested, here getview function. totalprice() method of orderchoice 1 changes depending on else selected.

@override public view getview(int position, view convertview, final viewgroup parent){     final editingorderchoiceadapter adapter = this;     view choiceview = convertview;     if (choiceview == null){         layoutinflater choiceviewinflater = (layoutinflater)getcontext().getsystemservice(context.layout_inflater_service);         choiceview = choiceviewinflater.inflate(r.layout.order_choice_row, null);     }      final orderchoice orderchoice = choices.get(position);     if (orderchoice != null){         textview choicename = (textview)choiceview.findviewbyid(r.id.choice_name);         choicename.settext(orderchoice.choice.name);          textview choiceprice = (textview)choiceview.findviewbyid(r.id.choice_price);         choiceprice.settext(orderchoice.totalprice().formatted());          checkbox choicecheckbox = (checkbox)choiceview.findviewbyid(r.id.choice_checked);         choicecheckbox.setoncheckedchangelistener(new compoundbutton.oncheckedchangelistener(){              @override             public void oncheckedchanged(compoundbutton buttonview, boolean ischecked) {                 orderchoice.selected = ischecked;                 adapter.notifydatasetchanged();             }         });         choicecheckbox.setchecked(orderchoice.selected);     }     return choiceview; } 

are recreating collection or updating items in collection? if recreate collection, notifydatasetchanged() won't work. in case items being updated, should work.

if need destroy/recreate collecion, set new adapter list.


Comments

Popular posts from this blog

jasper reports - Fixed header in Excel using JasperReports -

media player - Android: mediaplayer went away with unhandled events -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -