Skip to content Skip to sidebar Skip to footer

Notification/event For Row And Column Level Observation In Content Provider

I have content provider which has one Table. I would like to know when ever the table rows are modified. I am using Content Observer for the Table URI, which does tell when the tab

Solution 1:

ContentObserver, and the whole ContentProvider framework, does not support what you want.

If the provider and its consumers are in the same app, you can use an event bus to raise more fine-grained events. Common event bus implementations include LocalBroadcastManager, greenrobot's EventBus, and Square's Otto.

If the provider and its consumers are in separate app, you will be limited to using system-level broadcasts or similar IPC mechanisms for which you can better control the protocol.

Solution 2:

Send an id based URI to your contentobserver. The contentObserver can then use the id to get to the row that was changed.

example rowid 323 of mytable in uri.

content://com.example/mytable/323

Sorry I don't have access to my android dev from this pc or I could give a more accurate example.

Post a Comment for "Notification/event For Row And Column Level Observation In Content Provider"