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
Developer
Posts: 296
Registered: ‎12-07-2008
My Device: Not Specified

Need a little help with keylistener

I was just wondering if there is any way to find out if a user is holding down a key.

 

I'm trying to figure out if the user is holding down the menu key to bring up the app switcher. No matter what I try though I can never get any info from the keylistener. Keydown works fine if you just click the key same with key up but if you hold it down and the app switcher opens up then my app loses focus and the key listener never gets called. I was wondering if there is a different way to do this or if I'm just missing something?

 

Developer
Developer
Posts: 1,123
Registered: ‎02-10-2009
My Device: 8130 / 8350 / 9530 / 9550 / 9850 / PlayBook
My Carrier: Verizon

Re: Need a little help with keylistener

You can use a variable to track the keydown until keyup is called, but I think its been discuseed before that there is no way to override the app switcher so that will not work for the BB menu key.
Developer
Posts: 296
Registered: ‎12-07-2008
My Device: Not Specified

Re: Need a little help with keylistener


CMY wrote:
You can use a variable to track the keydown until keyup is called, but I think its been discuseed before that there is no way to override the app switcher so that will not work for the BB menu key.
Thanks cmy the issue I'm having though is the keydown is never called if I hold down the menu key. If I tap the menu key then keydown is called but if I hold it it never gets called for some reason.
Developer
Developer
Posts: 1,123
Registered: ‎02-10-2009
My Device: 8130 / 8350 / 9530 / 9550 / 9850 / PlayBook
My Carrier: Verizon

Re: Need a little help with keylistener

I think that is done on purpose and handled by the UI so that pressing the button doesn't call the users's code as well as the app switcher.