When i run my application and press any keys nothing happens.I want to capture the key events.what am i doing wrong.
Code:
public class Panic_Entry extends MainScreen implements KeyListener {
public Panic_Entry() {
super();
setTitle("Hello");
Application.getApplication().addKeyListener(this);
//super.addKeyListener();
}
public boolean keyChar(char key, int status, int time) {
boolean retval = false;
switch(key) {
case Characters.ESCAPE:
Dialog.alert("Escape");
break;
case Characters.DELETE:
Dialog.alert("Delete");
break;
default:
retval = super.keyChar(key,status,time);
}
return retval;
}
public boolean keyStatus(int keycode, int time) {return true; }
public boolean keyRepeat(int keycode, int time) {return true; }
public boolean keyUp(int keycode, int time) {return true; }
public boolean keyDown(int keycode, int time) {return true; }
}