"Menu" button disabled when I override onKeyDown

by kingkung » Mon, 19 May 2008 16:22:21 GMT


Sponsored Links
 I am overriding onKeyDown in my activity, and calling
super.onKeyDown() on all values except for the "Call" button, which I
implement myself.

The other buttons seem to work, but the Menu fails to load when I hit
the Menu button.  What can I do to get around this?

Thanks,

James

        public boolean onKeyDown(int keyCode, KeyEvent event)
        {
                switch (keyCode)
                {
                        case 5:
                                //perform call function
                                break;
                        default:
                                super.onKeyDown(keyCode,event);
                }
                return true;
        }
--~--~---------~--~----~------------~-------~--~----~



"Menu" button disabled when I override onKeyDown

by Romain Guy » Mon, 19 May 2008 16:29:58 GMT


 Hi,

Returning true from onKeyDown() means "I handled the key event, ignore
it." You are telling the system to ignore the key event. Your code
should return false by default and true only in case 5 (note you
should use the constatnts instead of hard coded values because the key
codes might change.)






-- 
Romain Guy
www.curious-creature.org

--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


"Menu" button disabled when I override onKeyDown

by kingkung » Mon, 19 May 2008 18:53:10 GMT


 Thanks, that was it.

Somewhat unrelated, but simple, question... how do I get the menu to
look like a list of items instead of the table format that it's
currently using?




--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. How to catch long keydown?

I've tried, but couldn't find anything. Is there any way to determine
that the key is longpressed?
--~--~---------~--~----~------------~-------~--~----~

2. Atlanta Android Users Group

This post is for any developers in the Atlanta area that are looking
for an Android users group to work with.  I would like to form a group
that can be used to help each other with application ideas, mentoring
and android tutorials on a local level for the upcoming Android
Developers Challenge II for 2009.  Send me a reply if you are
interested and we can go from there.

Thanks
sr98bj
--~--~---------~--~----~------------~-------~--~----~

3. 2D Double Buffering in Android 1.5 (with Canvas?)

4. Regd. Android Wrapper Classes on top of SKIA Classes

5. San Francisco Android App Release Party/Meetup This Sunday:

6. Issues with Hello World

7. Create an Adapter for Gallery