Key Events in TabActivities?

Posted by stormin986 on Stack Overflow See other posts from Stack Overflow or by stormin986
Published on 2010-05-08T23:33:06Z Indexed on 2010/05/08 23:38 UTC
Read the original article Hit count: 138

Filed under:
|

I have a TabActivity and want to catch and handle presses of HOME and BACK. Where do I need to catch these events?

In my subclass of TabActivity I implement the following:

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    switch (keyCode) {
        // Code handling
    }

    return super.onKeyDown(keyCode, event);
}

Didn't work.

So I placed a breakpoint on the switch statement line. But this function never gets called, whether I press volume up/down, menu, home, or back. Where do I need to catch these KeyEvents?

© Stack Overflow or respective owner

Related posts about android

Related posts about keyevent