开发者

Can content provider notify observer without calling NotifyChange() explicity - Android

开发者 https://www.devze.com 2022-12-22 17:35 出处:网络
In Conte开发者_如何学JAVAntProvider we explicity notify all registered observers to it by calling

In Conte开发者_如何学JAVAntProvider we explicity notify all registered observers to it by calling

getContext().getResolver().notifyChange(URI,ContentObserver);  

I want to know if this is necessary. Is there any possibility that observers get notified, even we don't use that statement at all in our contentProvider.

Is there any other way to do the same thing.


It does not appear that there is a way to do such a thing. You could (possibly) set up a Thread to periodically (perhaps once a minute) run a query against the ContentProvider that is guaranteed to return the latest time change in the underlying data set and then compare that to see if you need to do anything else, but it would be very content-provider specific and probably moderately difficult to generalize and maintain.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号