Preload Webview in step A and transfer it to step B for faster downloads

in one of my applications I use webview to load pages, I have Activity A and Activity B, Activity A displays a menu list, when you select any of the items in the list it will open Activity B, in Activity BI I perform all the actions related to the web viewer, such as downloading a webview using a URL, but its time to display this page, my question is there, I can preload the webview in step A and pass it to B for immediate download.

if it’s possible to preload the webview into Activity A and transfer it to Activity B for immediate provision, please let me know how this is possible?

Note. I can use the run dialog in step A until the webview load (wait until onPageFinished) is called and action B starts, but how can I load the webview right away?

+7
source share
2 answers

You cannot share the types of transfers between actions. Thus, you must stay within one action (you can use fragments to organize your views). Create a web view, hide it, start downloading data. Show web browsing when loading data.

PS You can manually download the html source code and / or some resources for use with a web browser later ... but it can be difficult.

+3
source

You cannot share views between actions, but depending on which page you are loading the URL on, you can cache the html in a file on the SD card and then load the WebView into activity B from that file.

0
source

All Articles