The use of Android drip Contentobserver

Source: Internet
Author: User

a conceptContentobserver is used to observe (capture) changes in data caused by a particular URI, and then to do some corresponding processing,when the URI observed by the contentobserver changes, it is triggered. The concept of contentobserver is particularly useful for monitoring changes in system data, such as database changes, or any other URI that has been registered in the Urimatcher class. For example: Settings.System.ACCELEROMETER_ROTATION, you can monitor the direction of the system screen. Two-use1. Create
Mobserver = new Contentobserver (new Handler ()) {public                void OnChange (Boolean selfchange) {                UPDATESCREENROTATIONBTN ();                                    }            };
2. Registration
Contentresolver CR = Getcontentresolver ();            Uri tmp = Settings.System.getUriFor (Settings.System.ACCELEROMETER_ROTATION);            Cr.registercontentobserver (TMP, FALSE, Mobserver);




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.