I'm writing a game. My dev. environment is Sun Wireless Toolkit 1.04
So, I use the emulators from there - everything is working perfectly. Now, I've downloaded an SDK for Nokia 7210 and a key problem appeared. When I press any key and release it instantly, I see on the phone emulator that key was pressed, but program could not receive this notification! When press a key and hold it a little bit, then program receives a multiple key press notifications. Is it a normal behaviour for this emulator and on real device everything should be OK? Or it is "feature"? and to avoid it???
I get key notifications from my class which extends Canvas
public class MyCanvas extends Canvas
protected void keyPressed(int keyCode)
int code = getGameAction(keyCode);
System.out.println("pressed key:" + getKeyName(keyCode) + " code:" + code);
I've noticed a delay between pressing keys and the keyPressed() method being triggered on the 7210 emulator. I've never seen it not trigger the method at all, which is what you seem to be indicating. I don't know if the delay is just a feature of the emulator, or of the phone as well -- I asked a similar question, look for the thread entitled "Key Polling" for more info. Anyway, the bottom line is that on any implementation there will always be a slight delay between you pressing a key and the keyPressed() method being called, due to threads etc. Whether this delay is noticeable to the user depends on the implementation.