Android,contentprovider+contentobserver+contentresolver, usage.

Source: Internet
Author: User

This is a picture of the intelligence podcast teacher talking about Android development.

One

Personprovider inherits the ContentProvider and implements the data manipulation classes in ContentProvider.

Adds a data change notification to an action that requires listening.

This.getcontext (). Getcontentresolver (). Notifychange (URI, NULL);

The second parameter, the data change listener, can not be set, also is set to NULL, if given this listener, no matter how many applications outside to set the listener, to listen to the data changes, this getcontentresolver () listener object, will inevitably get the data change notification.

This sentence is copied from elsewhere, but do not understand Ah Ah ~ ~ ~ ~

Second, set up monitoring

Setting up Monitoring
This.getcontentresolver (). Registercontentobserver (URI, True, new Personcontentobserver (New Handler ()));

For the parameters of this method, please refer to the following link in the explanation given by the great God:

Http://www.cnblogs.com/slider/archive/2012/02/14/2351702.html when an Insert method that calls Personprovider is applied, the onchange () method is executed, and print out the value of the field name. when executed, the listener's app must be open.

Android,contentprovider+contentobserver+contentresolver, usage.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.