Hi Mikael,
Using Instrumentation is a way to send key event.
Firstly initialize a Instrumentation instance:
Instrumentation mInstrumentation = new Instrumentation();
Then you can call it anywhere like below:
mInstrumentation.sendKeyDownUpSync(KeyEvent.KEYCODE_TAB);
Because this method is synchronized, it’s better to start a new thread so as
not to interrupt current session:
private void sendKey(final int keycode) {
new Thread(new Runnable() {
@Override
public void run() {
mInstrumentation.sendKeyDownUpSync(keycode);
}
}).start();
}
Wish this could help you.
Thanks,
Lin
From: Crosswalk-help
[mailto:[email protected]] On Behalf Of Morvan
Mikael
Sent: Wednesday, October 08, 2014 23:20
To: [email protected]
Subject: [Crosswalk-help] Send Key Event to the ChromeView
Hi all,
I'm trying to make my Android App interacting with the Chrome View. I'd like to
be able to programatically send key events to the Chrome View or even better,
be able to interract directly with the Dom of the Chrome View.
Is there a way to do that ?
Thanks
Mikael Morvan
_______________________________________________
Crosswalk-help mailing list
[email protected]
https://lists.crosswalk-project.org/mailman/listinfo/crosswalk-help