java - Update ListView items from another class -


i have issue when try update listview values. have custom adapter composed edit text. when click on edit text show dialog (that in class) , pass him same values position, arralist , other.

in dialog class i've method

public void updatevalue(string newvalue) {     myobject object = arraylist.get(position);         object.valuefile = newvalue;     arraylist.set(position, object);     myadapter adapter = new myadapter(context, 0, arraylist);     adapter.notifydatasetchanged(); } 

this method works because new values correctly insert array list text of edit text not updated updates when scroll, , go editt text. why? how can fix? problem?

you cannot new() adapter @ second time. adapter can new() 1 time.
if want update listview, need update data in arraylist

arraylist<yourtype> arraylist = new arraylist<yourtype>(); //init data arraylist //... //init adapter myadapter adapter = new myadapter(context, 0, arraylist);  //update item of listview public void updatevalue(string newvalue) {     arraylist.get(position).valuefile = newvalue;     adapter.notifydatasetchanged(); } 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -