Android Question catch submit button in webview

BerlinCoder

Member
Licensed User
Hi ,

I load an HTML file inside of a webview. I need to call an event in b4a after click/submit on an HTML button. How should I do it?

B4X:
    Javascript="B4A.CallSub('process_HTML', true, document.getElementById('fname').value+document.getElementById('lname').value)"
    WebViewExtras1.executeJavascript(WebView1, Javascript)
 

ronell

Well-Known Member
Licensed User
Longtime User
dont know if this will help but this is how override url works

B4X:
Sub Globals
 
    Dim wv As WebView
  
End Sub

Sub Activity_Create(FirstTime As Boolean)

    wv.Initialize("webview")
    Activity.AddView(wv,0,0,100%x,100%y)
    wv.LoadUrl("https://www.b4x.com/android/forum/")
  
End Sub

Sub webview_OverrideUrl (Url As String) As Boolean
    If Url.EndsWith("forum/") Then
 
        Return True
'you can do the b4a event here
    Else
       
        Return False
    End If
End Sub
 
Upvote 0
Top