0

I have 20+ html pages stored in asset folder in android. These html pages belongs to my website. And all the pages are at different depth in asset folder. (I am writing after 3-4 hours of searching on Google, SO, etc. but no clue! And I am new to android, so need help..)

Now when user types something related to the html pages in edittextview, then that bunch of words will be split in array and then all the words will be matched from all the html pages.

And if most of the words are matched then, user can see that particular webpage (html page) in webview.

How can I achieve that?

I did as said in http://www.monocube.com/2011/02/08/android-tutorial-html-file-in-webview/ but no clue!

And even did https://stackoverflow.com/a/24670620/5738881 but not what I am in need of!

Thanks.

Community
  • 1
  • 1

1 Answers1

0

A solution to this is too complicated to write here, but you will have to include some javascript with the HTML that will do the manipulation of the DOM. You have no access to the DOM from Java.

What you can do is call a javascript method in a page loaded into a WebView by loading a javascript url with a function call into some js entry point into the WebView via loadUrl. You can call back into Java from javascript using a mechanism that will require some study. Start by looking at addJavascriptInterface.

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441