Code example for ContentResolver

Methods: registerContentObserver

0
            super(handler);
        } 
 
        void observe() { 
            ContentResolver resolver = mContext.getContentResolver();
            resolver.registerContentObserver(
                    Settings.System.getUriFor(Settings.System.SCREEN_BRIGHTNESS), false, this);
            resolver.registerContentObserver(
                    Settings.System.getUriFor(Settings.System.SCREEN_BRIGHTNESS_MODE), false, this);
        } 
 
        @Override 
        public void onChange(boolean selfChange) {
            updateValues(); 
        } 
    } 
} 
Connect your IDE to all the code out there  Get Codota for Java