I have a fragment where I have a ListView with a BaseAdapter.
Then I have a popup menu where I select an option and it adds item to Collection.
The data from collection should be shown in the List, but it doesn’t show.
I need to add adapter.notifyDataChanged() to update the view.
The problem is that I may not have access to adapter from different classes. How is it possible to enable auto-ui updating?
PS. I tried to add the data from UI thread, but still nothing…
getActivity().runOnUiThread(new Runnable() {
public void run() {
GlobalData.groupTable.put(newGroup.getId(), newGroup);
}
});
Create a custom callback to update your Adapter. This approach is from the Developer’s Guide.