Skip to content Skip to sidebar Skip to footer

Adapter.notifydatasetchange() Not Working After Called From Onresume()

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 fun

Solution 1:

By using:

buckets = lightWeightDAO.getExerciseBucketsByWorkoutId(workout.getId());   
adapter.addAll(buckets);  

You have only added the contents of this new buckets to the adapter, you didn't bind the adapter to buckets. So this:

buckets.add(string);
adapter.notifyDataSetChanged();

has no affect on the data inside the adapter. Also like I mentioned above in the comments, you can add to the adapter directly and it will call notifyDataSetChanged() for you. So simply replace everywhere you use the two lines above with:

adapter.add(string);

Post a Comment for "Adapter.notifydatasetchange() Not Working After Called From Onresume()"