Skip to content Skip to sidebar Skip to footer

Listview Refresh Without Notifydatasetchange

There is a problem with notifyDataSetChanged. I have a list which retrieves data from sqlite database. The problem is that I know that I have to call notifyDataSetChanged everytime

Solution 1:

You're applying the adapter to your listview after updating the list mListFoodsIn, since your data is coming from a Database not via a network call the result returns relatively fast. So the correct list is applied to the listview on creation correctly. If the data were to change during the lifecycle of your fragment, then you would need to notify the adapter.

notifyDataSetChanged()

Notifies the attached observers that the underlying data has been changed

Post a Comment for "Listview Refresh Without Notifydatasetchange"