android – Screen Locks Continuously-ThrowExceptions

Exception or error:

I made a application to lock the screen. I write a code to lock the screen in a onCreate() method of activity,

Here the screen is locked correctly, but as I run application it locks the screen, now when I unlock it, it again shows the activity and then again lock the screen, so I can not do anything no what should I do.

WindowManager.LayoutParams params = getWindow().getAttributes();
params.screenBrightness = 0;
How to solve:

I dont think ur application is actually locking the screen. Its just turnig it OFF. When u try to unlock the screen, the screen is turning ON( due to user interaction ). As ur application is still running its forcing the sceern to turn OFF again. Just a wild guess, sorry if i mk completely wrong!!

Leave a Reply

Your email address will not be published. Required fields are marked *