title: Screen lock in Android
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/4545079/lock-the-android-device-programmatically">Lock the Android device programmatically</a>  </p>
  </blockquote>
  
  
  
  <p>Does the application have the ability to lock the screen? I have tried the following code, but nothing happens.</p>
  
  <pre><code>KeyguardManager keyguardManager = (KeyguardManager)getSystemService(Activity.KEYGUARD_SERVICE);
  KeyguardLock lock = keyguardManager.newKeyguardLock(KEYGUARD_SERVICE);
  lock.reenableKeyguard();
  </code></pre>