1

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.

Andrew T.
  • 4,701
  • 8
  • 43
  • 62
  • Can you tell if there was some exception thrown or error using those solutions or it just didn't do anything? Also your implementation could have been wrong – javdromero Apr 12 '21 at 13:58
  • Try this: https://stackoverflow.com/a/10268764/9796205 – Francesco Re Apr 12 '21 at 15:47
  • @javdromero there's no exception or error. Atleast not that catch (Exception e) block printed. –  Apr 14 '21 at 10:51

1 Answers1

0

I found my quesntion's solution in this post.

https://stackoverflow.com/questions/6503574/how-to-get-html-source-code-from-url-in-android[][1]

I don't know much about Ion dependency but it did my work.