executeJavascript closing virtual keyboard

dadi4

Member
Licensed User
Longtime User
during editing textbox in a webpage hosted inside WebViewExtras
when executeJavascript executed the virtual mobile keyboard close

any idea to solve this problem
 

warwound

Expert
Licensed User
Longtime User
Executing javascript actually passes the javascript to be executed to the WebView LoadUrl method.
The javascript to be executed has the javascript: pseudo protocol prepended to it and is then passed to to LoadUrl, for example:

B4X:
WebView1.LoadUrl("javascript:alert('Hello World)")

Calling LoadUrl will close the keyboard as you have posted.
A search on Google shows it's a known 'issue': android - WebView hides soft keyboard during loadUrl(), which means a keyboard cannot stay open while calling javascript - Stack Overflow.

The first solution posted in that link looks it might be possible with the Reflection library.

The other solution posted in that link suggests not to execute javascript using LoadUrl but to get your web page to poll a javascript interface for any javascript to execute - not ideal but it avoids calling LoadUrl and therefore will not cause the keyboard to be hidden.

Martin.
 
Upvote 0

dadi4

Member
Licensed User
Longtime User
I used poll to call sub in B4A from webpage Javascript and that was good for me.

Problem solved, Thanks
 
Upvote 0
Top