Post Reply

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

OP anjnkmr

28th April 2014, 03:44 PM   |  #1  
OP Junior Member
Thanks Meter: 0
 
2 posts
Join Date:Joined: Apr 2014
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);
}
});
28th April 2014, 04:08 PM   |  #2  
Masrepus's Avatar
Senior Member
Thanks Meter: 74
 
668 posts
Join Date:Joined: Feb 2013
More
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
28th April 2014, 06:38 PM   |  #3  
OP Junior Member
Thanks Meter: 0
 
2 posts
Join Date:Joined: Apr 2014
Tutorial
Quote:
Originally Posted by Masrepus

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...
28th April 2014, 08:44 PM   |  #4  
Masrepus's Avatar
Senior Member
Thanks Meter: 74
 
668 posts
Join Date:Joined: Feb 2013
More
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
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Top Threads in Java for Android App Development by ThreadRank