I want change the system brightness using my application. But as soon as i come out of that app. Brightness is again resetted to default value. What shud i do in order to make permanent change to brightness setting? I have tried few ways but all off them only work till my app is not closed.
Asked
Active
Viewed 324 times
1
-
duplicate of [How to change screen brightness](http://stackoverflow.com/questions/12487004/how-to-change-screen-brightness?rq=1) – John Dvorak Nov 02 '12 at 08:01
-
Yes but im not able to find a proper solution.. – Fahad Sarwar Nov 02 '12 at 08:08
-
See below. Let me know if it works. [Changing Screen Brightness](http://www.tutorialforandroid.com/2009/01/changing-screen-brightness.html) – retromuz Nov 02 '12 at 08:25
-
Already tried.. Its not working.. – Fahad Sarwar Nov 02 '12 at 08:27
-
Try this too. http://stackoverflow.com/questions/5032588/cant-apply-system-screen-brightness-programmatically-in-android – retromuz Nov 02 '12 at 08:29
1 Answers
0
This code is complite work for change brigtness of android deveice.
Settings.System.putInt(this.getContentResolver(), Settings.System.SCREEN_BRIGHTNESS, 20);
WindowManager.LayoutParams lp = getWindow().getAttributes();
lp.screenBrightness =0.2f;// 100 / 100.0f;
getWindow().setAttributes(lp);
startActivity(new Intent(this,RefreshScreen.class));
Also give below permission to manifest file
<uses-permission android:name="android.permission.WRITE_SETTINGS"/>

Arvind Kanjariya
- 2,089
- 1
- 18
- 23