1. ContentObserver is used to observe (capture) the changes of data caused by a specific Uri, and then perform some corresponding processing. When the Uri observed by ContentObserver changes, it will be triggered. In terms of concept, ContentObserver is particularly suitable for monitoring system data changes, such as database changes or any other Uri that has been registered in the UriMatcher class, such as Settings. system. ACCELEROMETER_ROTATION, which can monitor the direction of the System screen. Ii. Use 1. 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 );