Notification/Event for row and column level observation in Content Provider
Asked Answered
B

2

1

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 table is modified. However it does not give much information about which row is modified, also which columns are modified. I am looking for something similar to iOS API "handleManagedObjectContextDidChangeNotification".Is there any Open source library or API available for row and column level observation?

Benner answered 17/3, 2015 at 17:17 Comment(1)
You can try ContentObserver to listen to data changes.Fervidor
A
3

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.

Archpriest answered 28/3, 2015 at 0:8 Comment(0)
C
0

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.

Cottonmouth answered 30/3, 2015 at 22:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.