#if Java
Public class MyWebView extends WebView {
@Override
Public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
Return new BaseInputConnection(this, False); //this Is needed For #dispatchKeyEvent() to be notified.
}
@Override
Public boolean dispatchKeyEvent(KeyEvent event) {
boolean dispatchFirst = super.dispatchKeyEvent(event);
// Listening here For whatever key events you need
If (event.getAction() == KeyEvent.ACTION_UP)
switch (event.getKeyCode()) {
Case KeyEvent.KEYCODE_SPACE:
Case KeyEvent.KEYCODE_ENTER:
// e.g. get space And enter events here
break;
}
Return dispatchFirst;
}
}
#end if
It's probably a different error. The correct class name is WebView, case is important in Java, and you probably need the full class name android.webkit.WebView and even then I think this is a little too ambitious for inline Java.
Hi all. WebViewExtras is my latest library. It's a much updated version of JSInterface. WebViewExtras exposes more of the available native Android WebView methods to your B4A application: addJavascriptInterface(webView1 As WebView, interfaceName As String) Add a javascript interface to...
I'm trying from several days to download webviewextras2 library from this suggested link: http://b4a.martinpearman.co.uk/webviewextras/ but it seems to be dead. Is there an alternative link? Thank you so much for your help! Ascanio
Hi all. Here's a new library that makes it easy to set and get various WebView WebSettings. Note that the official documentation for many of these settings is rather brief, sometimes vague or virtually non-existent! Here is an alphabetical list of all methods with a short description. I've...
Hello I have the following problem with the Webview how do I intercept certain keycodes that the webview does not react to them - but the keycodes are delivered to me by other means. It is about keycodes 19,20,21,23, 89,90 Best regards Frank
I'm trying to listen to key events in android web view. Example when user is filling a form, I should receive the key events. This is my WebView code public class MyWebView extends WebView impleme...
I'm trying to listen to key events in android web view. Example when user is filling a form, I should receive the key events. This is my WebView code public class MyWebView extends WebView impleme...
I have already tried many things.
put a panel over the webview and a
Keylistener is set up. It also works as long as the webview is enabled with focus. If I grant her the focus she gets the 'keys'.
the background. i want to use the Fire TV remote control from 'mouse' and need keycode 19,20,21,22,24.
If I switch the webview to focusable = false everything works as long as I can't enter anything into the input fields.
If I switch it to focusabel = True, I cannot move the 'mouse' anymore
ok... after all commands are written in small letters, the first attempt is made.
after that there is still an error.
symbol: class webview
location: package anywheresoftware.b4a.objects
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
1 error
probably the function is no longer available
#if Java
public class MyWebView extends android.webkit.WebView {
@Override
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
return new BaseInputConnection(this, false); //this Is needed For #dispatchKeyEvent() to be notified.
}
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
boolean dispatchFirst = super.dispatchKeyEvent(event);
// Listening here For whatever key events you need
if (event.getAction() == KeyEvent.ACTION_UP)
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_SPACE:
case KeyEvent.KEYCODE_ENTER:
// e.g. get space And enter events here
break;
}
return dispatchFirst;
}
}
Even if you could get it to compile that Java code by itself is not sufficient to do what you want. You might be able to define a derived class but you still need an instance of it to use it. I'm afraid that you require a better understanding of Java than you seem to have to implement this.
If WebView was a real View then it would be no trouble. However WebView is not designed to be a local View but as a display mechanism for a remote server which is why you cannot interact with it as if it were a standard View. I don't do webby stuff so I can't really advise, and I don't know how much under your control is whatever you are viewing in the WebView. In fact is WebView the right sort of view for what you want to achieve or is there another alternative that can display HTML or rich text?
This really shouldn't be that difficult... I've got a web based App in B4A which passes information back to B4A using Javascript.
I think we need a little more information to help.
Are you....
Using WebView to display a specific HTML file/locally based HTML files and then use the user input to perform some B4A actions or something completely different?