I am creating a app and using WebView for open URL. I see some apps offer “Save Page”(A web page) option to user.
I want to know how to Save a page from my WebView so that I can show it to user when it request.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Maybe using a cache is the best way… for that you should check http://developer.android.com/reference/android/webkit/WebSettings.html
Especifically:
Since: API Level 1
Don’t use the network, load from cache only. Use with setCacheMode(int).
Constant Value: 3 (0x00000003)
Or
Since: API Level 1
Use cache if content is there, even if expired (eg, history nav) If it is not in the cache, load from network. Use with setCacheMode(int).
Constant Value: 1 (0x00000001)
Update1:
hmm “crappy code of all life” for example:
So, you can fetch a url with InputStream fetch(String url) an then convert that stream to String with private static String convertStreamToString(InputStream is) and save that stream to a file, later you can load that content to a webview….. to read later
Update2:
Or you can do some Java Serialization stuff… cant remember if this work on android xD
Discover the secrets of the Java Serialization API http://java.sun.com/developer/technicalArticles/Programming/serialization/