Q: Intercept Android system keyboard shortcuts to override functionality Is it possible for an Android application to intercept external keyboard shortcuts (e.g. Alt+Tab) and action them before the OS performs the default behaviour? Using Alt+Tab as an example, I would like to be able to have my app respond to Alt+Tab within my application and not have Android switch applications to a different app.
I have tried searching, but have not been able to find an answer, I think my Google-Fu is failing me!

A: It maybe is not as extense or detailed as it would be needed for capturing a shortcut, but you may want to override the onKeyDown event in your activity.
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if ((keyCode == KeyEvent.KEYCODE_BACK)) {
        Log.d(this.getClass().getName(), "Back button pressed");

    }
    if ((keyCode == KeyEvent.KEYCODE_HOME)) {
        Log.d(this.getClass().getName(), "Home button pressed");

    }
    if ((keyCode == KeyEvent.KEYCODE_MENU)) {
        Log.d(this.getClass().getName(), "Menu button pressed");
    }
    //return true;
    return super.onKeyDown(keyCode, event);
}

