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

Trusted Contributor
Posts: 104
Registered: ‎02-05-2012
My Device: Bold 9900 (primary) Z10 LE (secondary)
My Carrier: Singtel

how to listen key input event in GLField


I am just beginning the java development on BB OS7 (newbie for Java programming). I trying to modify the "OpenGL11Demo" example so that I can control the rotation of the animated cube. But how can I add the functions to listen the key input events in the GLField? I have inherited the keyChar(), keyUp(), keyDown() and other protected key event functions. But it CAN'T LISTEN ANY INPUT (seems no catch in debug).

However, I also check the "OpenglSpriteDemo" which implements AnimationListener inferface and inherits the above key event functions. It can capture key input.

I check some resource on internet but can't figure it out. Can someone help to give a suggestion? Should I forcely implement KeyListener on GLField when creating my own OpenGL field so that it can listen any key event? Thanks.