Android Question Webview findAll using Reflection. How to count?

GERSON PINTO

Member
Licensed User
What is the log output per example you are using?



B4X:
Log(FindAll(WebView1, "Basic4android")
Thanks DonManfred
Well! I found another way (more simple and not use reflection) to highlight:
word as string to search

Dim jo As JavaObject=WebView1
Log(jo.RunMethod("findAllAsync", Array(word)))

but both show log null (last method) or 0 Log(FindAll(WebView1, "Basic4android"))
 

DonManfred

Expert
Licensed User
or 0 Log(FindAll(WebView1, "Basic4android"))
Was Basic4android in the htmlpage available?

The zero suggests there was no result found.

Try it again with searching a word which is available in the html.
- Count the marked words found.
- Compare the value to the result of
B4X:
Log(FindAll(WebView1, "searchword"))
To be more precise (or to show you what i mean):

B4X:
dim search as string= "searchword"
dim foundwords as int = FindAll(WebView1, search)
log($"I´ve found "${search}" ${foundwords} times "$)
 
Last edited:

GERSON PINTO

Member
Licensed User
Was Basic4android in the htmlpage available?

The zero suggests there was no result found.

Try it again with searching a word which is available in the html.
- Count the marked words found.
- Compare the value to the result of
B4X:
Log(FindAll(WebView1, "searchword"))
To be more precise (or to show you what i mean):

B4X:
dim search as string= "searchword"
dim foundwords as int = FindAll(WebView1, search)
log($"I´ve found "${search}" ${foundwords} times "$)

I've even tried another site (https://www.b4x.com) with your code
search="Android"
The page loads normally, the words found are highlighted but the log is "I´ve found "Android" 0 times "

The problem remain...
 

GERSON PINTO

Member
Licensed User
I am using findallSync as java object to search and highlight all words found in webview. Works fine!
findlistener to count the number of occurrences?
How can I use it and how I can initialize the FindListener???
Any help are welcome!!!
 
Last edited:
Top