So, I have a code that adjusts the brightness of the system, and I implemented the search bar correctly, but when I adjust the search bar, the brightness of the screen does not change. I looked through a few other posts, and it looks like the solution is to create a Dummy class that quickly opens and closes. If I do this, then I will feel that there will be a ton of delay, because the screen will be constantly updated as the arrow moves.
@Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { ContentResolver cr = getContentResolver(); try{ int brightness = Settings.System.getInt(cr,Settings.System.SCREEN_BRIGHTNESS); Settings.System.putInt(cr, Settings.System.SCREEN_BRIGHTNESS, brightness); WindowManager.LayoutParams lp = getWindow().getAttributes(); lp.screenBrightness = brightness / 255.0f; getWindow().setAttributes(lp); } catch (Settings.SettingNotFoundException a) { } } @Override public void onStartTrackingTouch(SeekBar seekBar) {
Another problem with the update is that I run this brightness control on the screen, where there is a preview of the camera and killing the camera every time it takes a while to load the dummy screen and further increase the delay
I saw this post, but I could not figure out how to implement it. Since I do not use settings
I have a pointer in my preference for updating screen brightness. Is there a way to update the user interface to see the changes in real time?
source share