Blackberry (Java) - Can't get KeyListener to work
- by paullb
I am trying to get the KeyListener working for Blackberry, but none of the Dialogs pop up indicating that a key has been pressed (see code below, each action has a dialog popup in them). 
Any ideas on what i might be doing wrong?
public class CityInfo extends UiApplication implements KeyListener
{
 static CityInfo application;
 public static void main(String[] args)
 {
  //create a new instance of the application
  //and start the application on the event thread
  application.enterEventDispatcher();
 }
 public CityInfo()
 {
  //display a new screen
  application = new CityInfo();
  pushScreen(new WorkflowDisplayScreen());
  this.addKeyListener(this);
 }
 public boolean keyChar(char arg0, int arg1, int arg2) {
  // TODO Auto-generated method stub
  Dialog.alert("key pressed : " + arg0);
  return true;
 }
 public boolean keyDown(int keycode, int time) {
  // TODO Auto-generated method stub
  Dialog.alert("keyDown : " + keycode);
  return false;
 }
 public boolean keyRepeat(int keycode, int time) {
  // TODO Auto-generated method stub
  Dialog.alert("keyRepeat : " + keycode);
  return false;
 }
 public boolean keyStatus(int keycode, int time) {
  // TODO Auto-generated method stub
  Dialog.alert("keyStatus : " + keycode);
  return false;
 }
 public boolean keyUp(int keycode, int time) {
  Dialog.alert("keyUp : " + keycode);
  // TODO Auto-generated method stub
  return false;
 }
}
I also tried implementing keyChar on the MainScreen class but that did not yield any results either.