How to find the screen is locked in android
<p>For my application, I need to know that the screen is locked. How to check this in problematically. I used following flag:</p>

<pre><code>if(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON != 0){
    // some code
}else if((WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED)!= 0){
   // some code
}
</code></pre>

<p>But this always executing both if and else part... which flag I have to use to check the screen is locked or not?</p>
