4

We are loading Android Webview with local HTMLs and all resources in sdcard. As HTMLs are heavy (around 1MB per page) so we are working over preloading strategy means having webview instances already loaded in memory.

Over UI, we have Horizontal scrollview with series of Linear Layouts of Webview.

Preloading strategy works for all devices apart from Nexus7. On Nexus7, webpages are getting loaded but not displayable. Means when i swipe to next page then it first shows blank screen then it shows WebPage. But for other devices, it doesn't show blank page even.

We have tried all params like hardware acceleration, DOMCacheEnabled and other parameters. We need to avoid blank screen so that as soon as user swipes to next page, he can see the HTML directly rather than first blank page then HTML.

Please suggest if there is anything else we can use.

Adeesh Jain
  • 645
  • 10
  • 22
  • I am trying to achieve the same thing. Can you provide some details on how your preloading strategy works? tnx! – Yaniv Efraim May 13 '13 at 21:41
  • Hello, We are trying to load pages (current+1) and (current-1) along with current in memory. As soon user swipes we have built up the algorithm to load new page corresponding to that accordingly. Now this approach seems to be fine on all other devices except Nexus. – Adeesh Jain May 27 '13 at 07:17

1 Answers1

0

I implemented a solution similar to this, and this was my strategy;

Create webviews for necessary pages, add them, hide them, listen for them to load, then present the pages when your WebViewClient tells you they are finished loading.

I think the trick for getting them to show content (Not sometimes showing blank) was to

1 add the webviews to the layout

2 Call View.setVisibility(View.GONE)

3 Wait for it to load

4 View.setVisibility(View.VISIBLE)

DagW
  • 955
  • 1
  • 15
  • 28