3

I have an application and instead of keeping the screen on, once the app runs I want the screen to go dark. How do I do this? I know that to make the screen stay on I do this:

getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

But I cannot find out how to make the screen go dark.

Henry
  • 42,982
  • 7
  • 68
  • 84
Jerg
  • 95
  • 1
  • 6

1 Answers1

0

check this http://rdcworld-android.blogspot.com/2012/03/lock-phone-screen-programmtically.html

OR Try this one

WindowManager wm = Context.getSystemService(Context.WINDOW_SERVICE);   

//Lock device  
DevicePolicyManager mDPM = (DevicePolicyManager)getSystemService(Context.DEVICE_POLICY_SERVICE);
mDPM .lockNow();
Jins Lukose
  • 699
  • 6
  • 19