Custom CursorLoader notify data change

丶灬走出姿态 提交于 2020-01-14 04:41:05

问题


I was looking at the answer for making a Custom CursorLoader, and was wondering that if the data changes would there will be a notification of the data changing so that the list updates?


回答1:


I'm using the compatibility library loader framework. When content changes I just call this and everything gets updated:

    getSupportLoaderManager().getLoader(YOUR_LOADER).onContentChanged();



回答2:


You could call notifyDataSetChanged on your adapter so that the ListView will display the updated cursor content.

From the documentation:

Notifies the attached observers that the underlying data has been changed and any View reflecting the data set should refresh itself.



来源:https://stackoverflow.com/questions/8316140/custom-cursorloader-notify-data-change

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!