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
Regular Contributor
dan12345
Posts: 64
Registered: ‎02-03-2010
My Device: Bold

Keypad.getKeyCode() and Keypad.keyCode() always return 0

Keypad.getKeyCode() and Keypad.keyCode()Hi

I'm trying to do the reverse of translating keycode to char, by using the Keypad class. Problem is both Keypad.getKeyCode() and Keypad.keyCode() always return 0, no matter what i do.

 

I have tried

 

Keypad.getKeyCode('a',0)

Keypad.keyCode('a',KeypadListener.STATUS_ALT)

Keypad.getKeyCode('a',0)

Keypad.keyCode('a',KeypadListener.STATUS_ALT)

 

But i always get 0. 

 

Any ideas?

 

Thanks,

Dan. 

BlackBerry Development Advisor
MSohm
Posts: 14,753
Registered: ‎07-09-2008
My Device: BlackBerry Passport

Re: Keypad.getKeyCode() and Keypad.keyCode() always return 0

I wasn't able to reproduce this.  What BlackBerry Smartphone model and BlackBerry device software version are you testing on?  You can find this under Options, About on the BlackBerry Smartphone.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Regular Contributor
dan12345
Posts: 64
Registered: ‎02-03-2010
My Device: Bold

Re: Keypad.getKeyCode() and Keypad.keyCode() always return 0

I have seen this behavior both on the 7105 4.3.0 simulator, and 9105 5.0.0 simulator. 

Regular Contributor
dan12345
Posts: 64
Registered: ‎02-03-2010
My Device: Bold

Re: Keypad.getKeyCode() and Keypad.keyCode() always return 0

Sorry - I mean 8120 simulator and not 7105.

BlackBerry Development Advisor
MSohm
Posts: 14,753
Registered: ‎07-09-2008
My Device: BlackBerry Passport

Re: Keypad.getKeyCode() and Keypad.keyCode() always return 0

I tried the same simulators and still received 65,0,65,0, which is the expected behaviour.

 

Alt+a doesn't directly map to a key, which is why 0 is returned.  However, I received 65 for the keyCode for the letter a.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker