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
sblantipodi
Posts: 1,178
Registered: ‎02-19-2009
My Device: Not Specified
Accepted Solution

Is there a keycode for digit?

As title, what is the keycode for DIGITs that I can use inside the keyDown(int keyCode, int time) method?

 

 

Please use plain text.
Developer
jprofitt
Posts: 604
Registered: ‎12-27-2010
My Device: Not Specified

Re: Is there a keycode for digit?

Take a look at the Keypad class, should get you the info you need.

Please use plain text.
Developer
sblantipodi
Posts: 1,178
Registered: ‎02-19-2009
My Device: Not Specified

Re: Is there a keycode for digit?

 

I have looked into it and I haven't find what I am looking for.

Please use plain text.
Developer
jprofitt
Posts: 604
Registered: ‎12-27-2010
My Device: Not Specified

Re: Is there a keycode for digit?

What are you trying to do?

Please use plain text.
Developer
sblantipodi
Posts: 1,178
Registered: ‎02-19-2009
My Device: Not Specified

Re: Is there a keycode for digit?

I have mixed RIM API and MIDlet API, so I have listener from both world.

I have void keyPressed(int kc) from MIDlet world

and keyDown(int keyCode, int time) from RIM world.

 

I would like to know when a user press a DIGIT button and than do something.

I would like to know if the user pressed the 1 button, the 2 button, the 3 button ecc. ecc.

 

To do this I need to know at what keyCode button 1,2,3,4,5,6,7,8,9,0 corresponds.

RIM APIs is so good and than fails in a simple documentation like this, can't understand it.

Please use plain text.
Developer
jprofitt
Posts: 604
Registered: ‎12-27-2010
My Device: Not Specified

Re: Is there a keycode for digit?

Does Keypad.getUnaltedChar('1') not work? Alternatively, have you tried to override keyChar(character ch, int status, int time) and see if ch == KeypadListener.DIGIT_ONE, etc?

Please use plain text.
Developer
sblantipodi
Posts: 1,178
Registered: ‎02-19-2009
My Device: Not Specified

Re: Is there a keycode for digit?

 


jprofitt wrote:

Does Keypad.getUnaltedChar('1') not work? 


Great, with that worked ok, thanks!

 

 

 

Please use plain text.
Developer
jprofitt
Posts: 604
Registered: ‎12-27-2010
My Device: Not Specified

Re: Is there a keycode for digit?

Awesome, glad it did! I hadn't tried it so I wasn't sure :smileyhappy:

Please use plain text.