Reputation: 391
In my android application, there is a service which inserts records into database table A, and I need to do some operation whenever any new record is inserted in the database table A.
How can I continuously observe table A with a ContentObserver? What URI should I give to get notified whenever any change occurs in table A as we do in order to observe CallLogs and Contacts URIs?
Upvotes: 0
Views: 316
Reputation: 12505
You can't "observe a table" with a content provider. Changes in SQLite db cannot trigger any java code.
You can however (and this is what contacts and log providers do) notify everyone interested after each insert.
So:
Upvotes: 2
Reputation: 24730
the same way: create a custom ContentProvider to access your db tables
Upvotes: 0