helloandroid wrote:And so, how to simulate the input (eg, KeyEvent.KEYCODE_A) to the program if the button is clicked?
plusminus wrote:Hello helloandroid ,helloandroid wrote:And so, how to simulate the input (eg, KeyEvent.KEYCODE_A) to the program if the button is clicked?
On how to simulate Keystrokes, have a look here: http://www.anddev.org/viewtopic.php?t=717
cadlg wrote:Hi helloandroid.
I think that simulate a keystroke for that is too expensive. You could write the "a" to screen by code in the onClick event of the button.
cadlg wrote:I think yes, if you want to do something when the 'a' key is pressed, I think you will have to overwrite that method, and write another method to do what you need to do, which will then be called from both the onKeyUp and the onClick.
cadlg wrote:this is how you can simulate key strokes (taken from a plusminus tutorial):
get the window manager service:
inject the key event:
Users browsing this forum: No registered users and 16 guests