title: Changing screen brightness programmatically (as with the power widget)
body: <p>I was searching how to change the brightness of the screen programmatically and I found <a href="https://stackoverflow.com/questions/3737579/changing-screen-brightness-programmatically-in-android">this</a> it is very good solution and it works nice, but it works only while my app is active. After my application is shutdown then the brightness is returned back the the same value as before I start my app.</p>
  
  <p>I want to be able to change the brightness just like when I press on the brightness button from my power widget. In the power widget that comes from android there are 3 states. One very bright one very dark and one in between. Is it possible to change the brightness just like when someone press on this widget ?</p>
  
  <p><img src="https://i.stack.imgur.com/XjWhn.png" alt="enter image description here"></p>
  
  <p>Edit1:
  I created this and I added permision to my manifest but when the app is started I do not see any changes to the brightness, I tried with 10 with 100 and now with 200 but no changes
  any suggestions ?</p>
  
  <pre><code>public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  android.provider.Settings.System.putInt(this.getContentResolver(),
          android.provider.Settings.System.SCREEN_BRIGHTNESS, 200);
  }
  </code></pre>