title: Screen brightness value in Android
body: <p>How do you get the current screen brightness of your activity?</p>
  
  <p>Following method works fine for setting the brightness to max by calling <code>setBrightness(100)</code>:</p>
  
  <pre><code>private void setBrightness(int brightness) {
      WindowManager.LayoutParams layoutParams = getWindow().getAttributes();
      layoutParams.screenBrightness = brightness/100.0f;
      getWindow().setAttributes(layoutParams);
  }
  </code></pre>
  
  <p>Im trying to achieve the following:</p>
  
  <ol>
  <li>Start the activity and <strong>save the current brightness value</strong></li>
  <li>Set brightness to max</li>
  <li>Reset brightness to the initial value on certain events</li>
  </ol>
  
  <p>Many thanks!</p>