Unlock screen programatically and show activity
<p>I have one activity and its in foreground while screen is locked. This activity has a button, and when its pressed it should bring CALL LOG activity to the foreground, but instead i only got unlock screen activity ( see pic below ). But if i unlock that screen, my first activity showing is CALL LOG, but it should be visible without first unlocking screen. Hope i was clear enough. ( see pics below )</p>

<p>I checked <a href="http://stackoverflow.com/questions/3793221/how-my-app-can-unlock-screen-programatically?lq=1">How my app can unlock screen programatically?</a>, but its not working as it should!</p>

<p>Basically this is my code:</p>

<pre><code>@Override
public void onClick(View v) {

    switch(v.getId()) {

    case R.id.missed_call_IV:
        //finish();
        Intent showContacts = new Intent(Intent.ACTION_VIEW, Calls.CONTENT_URI);
        startActivity(showContacts);
        Window w;
        w = getWindow();
        w.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
        w.addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
        w.addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
        break;
    }
}
</code></pre>

<p><img src="http://i.stack.imgur.com/Gp1o6.png" alt="image1">
<img src="http://i.stack.imgur.com/2J0mB.png" alt="image2"></p>
