Android Back button code never executed
<p>I have the following code in my Activity. I have Breakpoints set to all of these methods. When I press the Menu button, it enters onKeyDown and onKeyUp. When I press the back button, the app closes and phone goes back to home screen without passing any of my breakpoints.</p>

<p>EDIT:
This could should work according to most sources:</p>

<pre><code>@Override
public void onBackPressed() {
    SwitchToMenuState();
}
</code></pre>

<p>However, it doesn't. I have tried all permutations of the following code blocks, and neither of them ever get called:</p>

<pre><code>@Override
public void finish()
{
    SwitchToMenuState();
}   

public boolean onKeyUp(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_BACK) {
        SwitchToMenuState();
    }
    return true;
}

public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_BACK) {
        SwitchToMenuState();
    }
    return true;
}   
</code></pre>

<p>I am using Android 2.3 and Processing, although it doesn't seem to be related to Processing at all. Eclipse tells me that I am overriding android.app.Activity.onBackPressed.</p>
