Hi, I have to call B4A sub from html loaded into WebView. I am using this libs:
I am using WevViewExtras2 becouse i have to load https web page from specific url...
But into my app i first must check internet connection and show error page when there is no connection...
Into this web page i have one button "ExitApp"
My error.html is into file:///android_asset folder
This is my html code:
And this i my B4A code:
But when i press button i can't run Sub AppClose_Request() into B4A app!
May be this is limitation of WebViewExtras2
- WevViewExtras2 version 2.20
- WevViewSettings version 1.30
I am using WevViewExtras2 becouse i have to load https web page from specific url...
But into my app i first must check internet connection and show error page when there is no connection...
Into this web page i have one button "ExitApp"
My error.html is into file:///android_asset folder
This is my html code:
HTML:
<div class="fixed-footer">
<div class="row">
<div class="col-6">
<a href="javascript:B4A.CallSubPlus('AppClose_Request', true,'1');" class="btn btn-secondary btn-lg btn-block">ExitApp</a>
</div>
<div class="col-6">
<a href="javascript:B4A.CallSubPlus('AppReload_Request', true,'1');" class="btn btn-primary btn-lg btn-block">Reload</a>
</div>
</div>
</div>
</div>
And this i my B4A code:
B4X:
Sub Activity_Create(FirstTime As Boolean)
WebView1.Initialize("WebView1")
WebViewExtras1.Initialize(WebView1)
Dim client As DefaultWebViewClient
client.Initialize("client")
WebViewExtras1.SetWebViewClient(client)
Activity.AddView(WebView1, 0, 0, 100%x, Activity.Height)
WebSettings.setDefaultTextEncodingName(WebView1,"utf-8")
WebViewExtras1.addJavascriptInterface(WebView1, "B4A")
WebView1.JavaScriptEnabled = True
WebView1.ZoomEnabled=False
End Sub
Sub AppClose_Request()
ToastMessageShow("Exiting...",True)
ExitApplication
End Sub
But when i press button i can't run Sub AppClose_Request() into B4A app!
May be this is limitation of WebViewExtras2