Can content provider notify observer without calling NotifyChange() explicity - Android
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.
精彩评论