Screen lock on button click

view full story

http://stackoverflow.com – I want to turn the android screen on button click,Now i had written a program for this in is not showing any errors also its not working.. The code for this is.. public class MainActivity extends Activity { Button powerOff; int amountOfTime =20*1000; Context context = this; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); powerOff = (Button)findViewById(R.id.button1); powerOff.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { (HowTos)