Unable to receive keyChar() event
Please Login to Remove!
Hi All,
I am a newbie, so I could be doing a silly mistake.
I want to trap the keyChar() event ( which I understand would provide me with the actual character as per the keyboard of the BB) which I would then like to display to the user.
I was trying a simple code (below) which prepares a J2ME form and subscribes to the keyListener interface. I am getting all the other events except keyChar().
Where am i going wrong here?
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
import net.rim.device.api.system.*;
public class testK extends MIDlet implements KeyListener{
Form form;
public testK() {}
protected void destroyApp(boolean arg0) throws MIDletStateChangeException { }
protected void pauseApp() { }
protected void startApp() throws MIDletStateChangeException {
form = new Form("New Form");
javax.microedition.lcdui.Display.getDisplay(this). setCurrent(form);
Application.getApplication().addKeyListener(this);
}
public boolean keyChar(char key, int status, int time){
form.append("Got Key Char Event" + key);
return false ;
}
public boolean keyDown(int keycode, int time){
return false ;
}
public boolean keyRepeat(int keycode, int time){
return false ;
}
public boolean keyStatus(int keycode, int time){
return false ;
}
public boolean keyUp(int keycode, int time){
return false ;
}
}
Thanks in advance!!
MG
|