Locking the screen in android
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/4545079/lock-the-android-device-programatically">Lock the android device programatically</a>  </p>
</blockquote>



<p>I want to lock the screen through my program. i am using the following code to do the same..But its not working for me..I dont know where i am wrong..even i am not getting any errors in logcat..I am using 1.6</p>

<pre><code>public class KeyGaurd extends Activity {
KeyguardManager keyguardManager;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
     keyguardManager = 
        (KeyguardManager)getSystemService(Context.KEYGUARD_SERVICE);

        KeyguardLock lock = keyguardManager.newKeyguardLock(KEYGUARD_SERVICE); 

        lock.reenableKeyguard();

}
</code></pre>

<p>And i used the permission also</p>

<pre><code>&lt;uses-permission android:name="android.permission.DISABLE_KEYGUARD"&gt;&lt;/uses-permission&gt;
</code></pre>
