I am having a problem where when I call the adapter.notifyDataSetChange()
to refresh the listActifity from the onResume()
function, it doesn't seem to be working from any other functions from that activity afterwards.
I want the list(view) to refresh when the user clicks the back button(while on another screen) and returns to the window with the list.
One of the things I noticed is that the notifyDataSetChange()
works(from other functions) when I change one of the objects from the array list but not when I want to add or delete an object from the ArrayList
. This has been working so far for me, but I would prefer not to have to requery the list every time.
@Override
protected void onResume() {
lightWeightDAO.open(); //db connection
adapter.clear();
buckets = lightWeightDAO.getExerciseBucketsByWorkoutId(workout.getId());
adapter.addAll(buckets);
adapter.notifyDataSetChanged();
super.onResume();
}
When I remove the notifyDataSetChange() from the onResume(), everything seems to work(just calling a simple notifyDataSetChange() after changing the arraylist).
Any idea why this is not working?