Pass Keystroke to Webview

java4never

Member
Licensed User
Longtime User
Hi!

I'm searching for a method to pass a keyevent to an existing webview.
In fact, this (http://www.b4x.com/forum/basic4andr...-simulate-hardware-keypress-2.html#post120246) is exactly what I need, but I can't get it to work:(
I'm gettin' the java exception: "This method can not be called from the main application thread.

First, I thought, I need the threading library...
So I've done everything like in the example, but also the example seems to be broken.
Searched for over 2 hours now, but nothing useful found:(
I would be very lucky, if someone could help!

regards
David W.
 
Is your WebView displaying a webpage with a form and you want to simulate user input on the form?

If so you can hopefully(!) execute javascript that simulates user input - you can complete form text fields and cause button clicks.

Search the forum for 'execute javascript'.

Martin.

Sent from my GT-P3110 using Tapatalk 2
 
Upvote 0
No

Nope, it’s nothing with js.
I really need an input like provided by this broken library?
Isn’t there anyone, who would like to repair it?;)
Would be cool!
 
Upvote 0
Not Sure

Hi Erel,

I’m not sure, if it’s that, what I’m looking for.
There isn’t any Webpage or HTML, but only a flashgame, where I want to implement controls.
As I said, the library would do it, and it looks like there are problems with the threading library, as the keysend library uses it, because it needs a new thread to work.
However, if I try to create a new thread, a java exception pops out, which says, that it haven’t found the sub. But the sub is there!

Thanks for helping me.

David W.
 
Upvote 0
Solved

Ok, after some testing the problem solved itself, no idea how.
The Treading Library works and so the the library to send keys.
It’s a bit unstable, but it works.

Anyway, thanks for the help:)

David W.
 
Upvote 0
Hi David W.,
Could you please share your example code? Thank you so much.
 
Upvote 0
Back
Top