reenablekeyguard not working
<p>I am very new to Android and this is my first program. I have been trying to create a simple activity with a button which will lock the screen. Below is my code, but this is not working even after full executon when I come back to the front screen the screen is not locked. I maybe doing something stupis, but please help. Below is my code:</p>

<pre><code>package com.droid.ScreenLock;

import android.app.Activity;
import android.app.KeyguardManager;
import android.app.KeyguardManager.KeyguardLock;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class MainActivity extends Activity {
    private KeyguardManager n;
    private Boolean b;
    private KeyguardLock l;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        Button tbut = (Button) findViewById(R.id.button1);
        tbut.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View arg0) {
                // TODO Auto-generated method stub
                n = (KeyguardManager) getSystemService(KEYGUARD_SERVICE);
                b = n.inKeyguardRestrictedInputMode();
            }
        });
    }

    public void onPause() {
        super.onPause();
        if (b != true) {
            l = (KeyguardLock) n.newKeyguardLock("User");
            l.reenableKeyguard();
            l = null;
        }
    }
}
</code></pre>
