Welcome!

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

Reply
New Developer
LTCCTL
Posts: 45
Registered: ‎08-16-2008
My Device: Torch 9800, Bold 9700, Storm 9550, Curve 8520

Capturing the Keypress event

Hi all,

 

When ever the key 5 is pressed on the phone I want to invoke a certain page/screen and also capture the key value(here it will be 5).

 

If some examples are available then please let me have the link or let me know how we can do it.

 

Thanks in advance

 

Regards

LTCCTL

Developer
RexDoug
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: Capturing the Keypress event

If you mean "capture a key presssed when my application screen has focus", then you would override keyChar() in your screen or field.

 

There are numerous examples in the documentation and in this forum.

 

Developer
peter_strange
Posts: 19,609
Registered: ‎07-14-2008
My Device: Not Specified

Re: Capturing the Keypress event

Be aware that the active application always has full control over the processing of keys.  You can't create a key logger or key listener on a BlackBerry.  I get the impression you always want the '5' to go to your application (so you can display your screen) regardless of which application is actually on the screen.  I don't think that is possible.