07-07-2009 03:58 AM
Hi folks- does anyone know the way to authorize the use of a keylistener and avoid the error message 'Unauthorized attempt to monitor keypresses' on the Bold device? The code is below:
tkl = new TheKeyListener();
MonthlySpend.getApplication().addKeyListener(tkl);
public static class TheKeyListener implements KeyListener
{
public TheKeyListener()
{
System.out.println("\n\n\nAdded key listener.\n\n\n");
}
// Implement methods in the KeyListener interface for handling keyboard events:
public boolean keyChar(char key, int status, int time)
{
return false;
}
public boolean keyDown(int keycode, int time)
{
System.out.println("Keycode is " + String.valueOf(keycode));
MonthlySpend.getApplication().removeKeyListener(tk
if (keycode == 1179648) // End button (red)
{
EventInjector.KeyCodeEvent simulateKey = new EventInjector.KeyCodeEvent(EventInjector.KeyCodeEv
simulateKey.post();
simulateKey.post();
return true;
}
else
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;
}
}
07-07-2009 07:10 AM
Check this thread. This might help you.
Regards
Bikas