How to change the brightness after starting and  stopping the service in  Android?
<p>In my application, when i am starting the Broad Cast Reciever, i am putting the phone in Dim Mode. For this i am using the below code:</p>

<pre><code>android.provider.Settings.System.putInt(getContentResolver(),android.provider.Settings.System.SCREEN_BRIGHTNESS, 0);
</code></pre>

<p>Before that, i am storing the previous brightness using Shared Preference and when i am stopping my application, i am changing the brightness to the previous stored brightness.</p>

<pre><code> float brightness = myPrefs.getFloat("previous_bright", 0.0f);
                    android.provider.Settings.System.putFloat(context.getContentResolver(),android.provider.Settings.System.SCREEN_BRIGHTNESS, brightness);
</code></pre>

<p>Now it is going to the dim mode. But when i am stopping the application, first i have to press the power button of the device and then i have to unlock it. Then only it is changing to its previous brightness. I am checking it in Google Nexus One. How an i change it without locking and unlocking it??</p>

<p>My OS version is 2.2. And it is coming fine in Android Tablet(Olive Pad).</p>
