Content Observer changes

浪尽此生 提交于 2020-01-03 20:09:12

问题


If I register a content observer on say the calendar database is there a way to get exactly what changed in the database when an event gets edited?


回答1:


Can't be done...Diane Hackborn claims it's intentional. You'll have to requery or use a sync adapter.




回答2:


Make use of shared preferences and content providers along with content observer.

When I read the DB, I know that I have read all the entries until the time stored in shared preferences. So each time I read DB, I need to check for all the changes after the time that was stored in shared preferences and update the time in the shared preferences to current time(after doing whatever you wanted to do with these new entries).



来源:https://stackoverflow.com/questions/7285903/content-observer-changes

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