0

This is any way to save content of web page in webview. I mean when I have a network connection I download all content and if I have no network connection I can still watch video or view all content. This is possible?

user1302569
  • 7,131
  • 13
  • 46
  • 66

1 Answers1

1

There is no good way to interrogate a webview about it's content. There are some workarounds involving javascript injection similar to this:

How to retrieve HTML content from WebView (as a string)

It maybe good enough for you if you are looking for certain things and don't necessarily need the whole kitchen sink that would come with a "View Page Source" in a desktop browser.

Ideally you would use an HttpURLConnection to retrieve the content if that is possible for you. Here is a snippet from the android sdk reference:

URL url = new URL("http://www.android.com/");
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
InputStream in = new BufferedInputStream(urlConnection.getInputStream());
readStream(in);

http://developer.android.com/reference/java/net/HttpURLConnection.html

Community
  • 1
  • 1
BrianPlummer
  • 164
  • 1
  • 5