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 suitable for monitoring changes in system data, such as a database modification, or any other URI that has been registered in the Urimatcher class. For example: Settings.System.ACCELEROMETER_ROTATION, the ability to monitor the orientation of the system screen. Two-use1. Create
Mobserver = new Contentobserver (new Handler ()) {public void OnChange (Boolean selfchange) { UPDATESCREENROTATIONBTN (); } };
2. Brochure
Contentresolver CR = Getcontentresolver (); Uri tmp = Settings.System.getUriFor (Settings.System.ACCELEROMETER_ROTATION); Cr.registercontentobserver (TMP, FALSE, Mobserver);