onBackPressed() of my activity does not get called when my activity pops up a dialog
<p>I have implementation <code>onBackPressed()</code>, it works when there is no popup alert dialog from my activity. But when my activity pops up a dialog, <code>onBackPressed()</code> never get called.</p>

<pre><code>public void onBackPressed() {
        super.onBackPressed();
// more implementation.
}
</code></pre>

<p>How can I detect back key is pressed by user when a dialog is pop up?</p>

<p>Thank you.</p>
