Sub Activity_Click
FindAll(WebView1, "Basic4android")
End Sub
Sub FindAll (w As WebView, s As String) As Int
Dim r As Reflector
r.Target = w
Return r.RunMethod2("findAll", s, "java.lang.String")
End Sub
I load a long html text in webview ,find and highlight all the keyword with above code, I want to see them one by one,but when I use below code,error occurred:"NoSuchMethodException: findNext [class java.lang.String]", Where is my fault?
B4X:
Sub FindNext_Click
FindNext(WebView1, "Basic4android")
End Sub
Sub FindNext (w As WebView, s As String) As Int
Dim r As Reflector
r.Target = w
Return r.RunMethod2("findNext", s, "java.lang.String")
End Sub
Hi Erel, I met another problem,I want to match and highlight multi keywords in webview,like below:
B4X:
Dim SS() as string
SS = Array As String("AAA", "BBB", "CCC")
Dim i as Int
Dim jo As JavaObject = WebView1
for i=0 to SS.length-1
jo.RunMethod("findAllAsync", Array(SS(i)))
next
Result: only "CCC" is highlighted, why, I want to highlight "AAA" and "BBB" and "CCC".
Dim SS() as string = Array As String("AAA", "BBB", "CCC")
Dim jo As JavaObject = WebView1
for Each s As String In SS
jo.RunMethod("findAllAsync", Array(s))
Sleep(200)
next
Dim SS() as string = Array As String("AAA", "BBB", "CCC")
Dim jo As JavaObject = WebView1
for Each s As String In SS
jo.RunMethod("findAllAsync", Array(s))
Sleep(200)
next
Hello, I have try the code of Erel (#5, Feb 9, 2018) for match and highlight multi keywords in webview.
It don't works. Only "CCC" is highlighted.
Did you find a solution ?
Thanks
Finds all instances of find on the page and highlights them, asynchronously. Notifies any registered FindListener. Successive calls to this will cancel any pending searches.