Trouble with Locking

view story

http://stackoverflow.com – I want to lock the screen of the app on button click I have written the code as public class MainActivity extends DeviceAdminReceiver{ public void makeTest() { System.out.println("Entered Main Class"); } public class Controller extends Activity { static final int RESULT_ENABLE = 1; Button powerOff; int amountOfTime =20*1000; Context context = this; DevicePolicyManager mDPM; ActivityManager mAM; ComponentName mDeviceAdminSample; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Syste (HowTos)