Preface: Work, need to open a thread a large number of queries a database value sent a change, resulting in a lot of overhead, later in the boss's guidance, the use of contentobserver perfect solution to the problem, feel very excited, After the finish, I also made a summary of contentobserver.
contentobserver--content Observer, the purpose is to observe (capture) a particular URI caused by the changes in the database, and then do some corresponding processing, it is similar to the database technology triggers (Trigger), when the Contentobserver observed by the URI changes , it will be triggered. Triggers are divided into table triggers, row triggers, and accordingly contentobserver are also classified as "table Contentobserver,
The line contentobserver, of course, is related to the URI MIME type it listens on.
Summary: The use of contentobserver is mainly a case of both:
1, the need to frequently detect the database or whether a data change, if the use of threading to operate, very economical and time-consuming;
2, in the case of users do not know the database to do some events, such as: Quietly send information, refuse to accept text messages blacklist, etc.;
In both cases, the use of contentobserver is undoubtedly the best razor.
See more: http://www.cnblogs.com/slider/archive/2012/02/14/2351702.html
Android Contentobserver Detailed