I am building an application which is dynamically populating/depopulating arraylist depending on Futuretask thread which communicates with server.
Problem is that when i add new object into my arrayadapter and in any way i call notifyDataSetChanged or setNotifyOnChange
(for example after adding item, i also tried make some postadd function which calls notifyDataSetChanged, or even tried adding setNotifyOnChange in adapter constructor, or before adding (adapter.setNotifyOnChange(true)))
in this Futuretask it simply freezes the thread and causes application malfunction. Without notifyonchange when i slide with my finger to call ArrayAdapter's getView() it works, but that is an undesired behavior.
Note: I am accessing the adapter by static variable reference.
Note#2: I dont think creating new adapter over and over again is a smart choice.
/edit:
My remove method looks like this:
public void remove (int itemid) {
for (ContactItem i : items)
if (i.ID == itemid)
items.remove(i);
}
(and it hangs in the end at the last pharantesis)