Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Regular Contributor
Posts: 52
Registered: ‎02-26-2013
My Device: Curve 9650,Bold 9900
My Carrier: Airtel

how to overwrite escape key (Key_Escape)...?


  In my application i need to overwrite some key like end key and escape key. end key overwriting works properly but escape key not.

i use code to overwrite these keys like this ,  i already implements keylistener interface


 int key = Keypad.key( keycode );

 if(  key == Keypad.KEY_END )

        else if(  key == Characters.ESCAPE)


other approach i used for escape key is


 if(  key == Keypad.ESCAPE)



plz give me a suitable help for this problm..

Posts: 17,025
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: how to overwrite escape key (Key_Escape)...?

overwrite the keyChar method in mainscreen.
return true after you have handled an input, otherwise return super.
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: how to overwrite escape key (Key_Escape)...?

for example:


        protected boolean keyChar(char character, int status, int time) {
                // regardless of where we are, Esc will exit
                switch (character) {
                        case Characters.ESCAPE:
                                return true;
                                return super.keyChar(character, status, time);