Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,772,214 Members 43,397 Now Online
XDA Developers Android and Mobile Development Forum

[Q] Settings are not applied after changing the SCREEN BRIGHT MODE

Tip us?
 
anjnkmr
Old
#1  
Junior Member - OP
Thanks Meter 0
Posts: 2
Join Date: Apr 2014
Tutorial [Q] Settings are not applied after changing the SCREEN BRIGHT MODE

I tried to change the SCREEN BRIGHTNESS MODE to Automatic, I Use the following code, It Changes the Check Box in Notification Area of the Mobile, But doesn't applied
Code:
       
toggleButton1.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
if(b)
 {
        autobr=1;
        s1.setEnabled(false);
        Settings.System.putInt(getContentResolver(), Settings.System.SCREEN_BRIGHTNESS_MODE,Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC);
 }
 else
 {
        autobr = 0;
        s1.setEnabled(true);
        Settings.System.putInt(getContentResolver(), Settings.System.SCREEN_BRIGHTNESS_MODE,Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL);
 }

       WindowManager.LayoutParams lp2=getWindow().getAttributes();
       lp2.screenBrightness = WindowManager.LayoutParams.BRIGHTNESS_OVERRIDE_NONE;
       getWindow().setAttributes(lp2);
}
});
 
Masrepus
Old
#2  
Masrepus's Avatar
Senior Member
Thanks Meter 72
Posts: 648
Join Date: Feb 2013
1. Does your phone surely support automatic brightness?
2. Did you declare relevant permissions to change the display brightness state?

---------------------------------
Phone : Nexus 4
OS:
Pure KitKat 4.4.2 stock, no root, no mods
---------------------------------

4d 61 73 72 65 70 75 73 20 66 74 77

Gesendet von Tapatalk
 
anjnkmr
Old
#3  
Junior Member - OP
Thanks Meter 0
Posts: 2
Join Date: Apr 2014
Quote:
Originally Posted by Masrepus View Post
1. Does your phone surely support automatic brightness?
2. Did you declare relevant permissions to change the display brightness state?

---------------------------------
Phone : Nexus 4
OS:
Pure KitKat 4.4.2 stock, no root, no mods
---------------------------------

4d 61 73 72 65 70 75 73 20 66 74 77

Gesendet von Tapatalk

I Checked in Samsung Galaxy Grand, It has a option to enable/ disable the Auto Brightness setting
When first I install this app, at first it shows effect, from next time it doesn't work...
please guide me...
 
Masrepus
Old
#4  
Masrepus's Avatar
Senior Member
Thanks Meter 72
Posts: 648
Join Date: Feb 2013
So are you sure that it doesnt work? Try putting manual brightness to minimum and then switch via your app to automatic brightness. Then put the phone under a bright lamp and see if there still is no effect visible. Because i cant really believe that it works once but then not. Maybe you just dont notice it because it already has adapted the right brightness

---------------------------------
Phone : Nexus 4
OS:
Pure KitKat 4.4.2 stock, no root, no mods
---------------------------------

4d 61 73 72 65 70 75 73 20 66 74 77

Gesendet von Tapatalk
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes