How to access HTML source from Android WebView?

Viewed 1188

I have a simple browser app. It loads some IP and displays it using WebView. I want to access the source code of the loaded URL and store into Android string so I can use it.

For an example :

Suppose it is loaded 10.0.0.1 and the webpage shows this.

LOADED HTML FILE

So, I want to store that "HELLO THERE". And further want to process if string is equal to "HELLO THERE", a toast will be shown.

I managed to load the URL, and I know how to make Toast. The problem is, I am not able to store that "HELLO THERE" in string.

Solution Tried :

  1. http://blog.weinigel.se/2014/03/05/getting-html-source-from-android-webview.html
  2. Is there a way to get the HTML in a webview in an Android app?
  3. How I get page source from WebView?

I have tried all of above solutions. But, none worked. It would be great if I get the answer using specific scenario of mine.

1 Answers
Related