<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ //Contrast<br>
+ private float mBrightnessValue = 0;<br></blockquote><div><br>why an instance variable when it's used only inside onCreate ?<br><br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ // Initialize the layoutParams screen brightness<br>
+ try {<br>
+ int brightnesstemp = android.provider.Settings.System.getInt(getContentResolver(),<br>
+ android.provider.Settings.System.SCREEN_BRIGHTNESS);<br>
+ mBrightnessValue = brightnesstemp / 255.0f;<br>
+ } catch (SettingNotFoundException e) {<br>
+ // TODO Auto-generated catch block<br>
+ e.printStackTrace();<br>
+ }<br>
+ WindowManager.LayoutParams lp = getWindow().getAttributes();<br>
+ lp.screenBrightness = mBrightnessValue;<br>
+ getWindow().setAttributes(lp);<br></blockquote><div><br>Why is it needed ? it works without this for me.<br>Also this doesn't take SCREEN_BRIGHTNESS_MODE into account. When set to automatic, the brightness value retrieved with SCREEN_BRIGHTNESS is not the real value set automatically by the OS. So when the activity starts, the brightness will be changed in onCreate. it would be ok if it was the right value, but i don't know how to get it.<br>
<br><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ // Adjust contrast<br>
+ if (jump > 0 || jump <= 1) lp.screenBrightness = jump;<br>
+ else if (jump > 1) lp.screenBrightness = 1;<br>
+ else if (jump <= 0) lp.screenBrightness = 0.01f;<br></blockquote></div><br>The first test is wrong, it's always true :p<br><br>