Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Preloading the Webview in Activity A and Passing it to Activity B for faster loading

in one of my app i am using webview to load the pages, the scenario is i have Activity A and Activity B, Activity A displays the menu list, on selection of any of the item in the list it will open Activity B, in Activity B I am doing all the webview related activities like loading webview using the URL but its taking lot of time to display that page, my question here is there anyway i can preload the webview in activity A and pass it to B for immediate loading.

if it's possible to preload the webview in Activity A and pass it to Activity B for immediate rendering please let me know how it is doable?

Note : I can use progress dialog in Activity A until the webview loads(wait till onPageFinished) get called and start the Activity B, but how can i make the webview load immediately here?

like image 367
Ramakanth Giri Avatar asked Jan 05 '13 11:01

Ramakanth Giri


1 Answers

You cant share of transfer views between activities in any way. So you should stay within single activity (you can use fragments to organize your views). Create webview, hide it, start loading data. Show webview when data is loaded.

P.S. You can manually download html source code and/or some resources to use with webview later... but this can be tricky.

like image 124
Leonidos Avatar answered Oct 20 '22 04:10

Leonidos