I am trying to implement speed dial using keystroke injection....
but keyrepeat event is not caught by this method...
can anyone tell me what can be the reason...
Code:
phoneNumberField = new EditField("", "", 40, EditField.USE_ALL_HEIGHT
| EditField.USE_ALL_WIDTH | EditField.FILTER_PHONE) {
/**
* Speed Dial Implementation using keystroke injection
*/
protected boolean keyRepeat(int keycode, int time){
System.out.println("KeyRepeat : "+ keycode);
if(phoneNumberField.getText().length()==1 ){
ApplicationHandler.setApplicationToBackground();
try{
Thread.sleep(500);
}catch (Exception e) {}
EventInjector.invokeEvent( new EventInjector.KeyCodeEvent( KeyCodeEvent.KEY_REPEAT,
(char)Keypad.key(keycode),0 , 200));
EventInjector.invokeEvent( new EventInjector.KeyCodeEvent( KeyCodeEvent.KEY_UP,
(char)Keypad.key(keycode), 0, 200));
ApplicationHandler.setApplicationToForeground(appProcessID);
return true;
}
return super.keyRepeat(keycode, time);
}
};