Sana
Sana

Reputation: 9915

How to make a android WebView load faster?

Anybody has some suggestions to make a webview faster to load the url?

In my situation, I am using the jQuery's getScript to load the javascript(s) when needed.

Thanks, Sana.

Upvotes: 13

Views: 13221

Answers (3)

user14519660
user14519660

Reputation: 51

I found this online, it worked for me. Note: Only works for Android API 18+.


        if (Build.VERSION.SDK_INT < 18) {
               //speed webview
               webView.getSettings().setRenderPriority(WebSettings.RenderPriority.HIGH);
           }

Upvotes: 1

Micah Hainline
Micah Hainline

Reputation: 14427

There is some built-in overhead to using a web view that cannot be avoided. Beyond that, if you are loading the web page from an external url, there is the time the network takes to load the web page, which also cannot be avoided in general. If there are some specifics to the problem that you think would lend themselves to being optimized, you haven't mentioned them. If you're asking if there is an easy way to make loading a web view "go faster", the answer is no.

Upvotes: 0

J.G.Sebring
J.G.Sebring

Reputation: 5964

This might not be suitable for your situation, but you could ignore loading images.

       webview.getSettings().setBlockNetworkImage(true);

if targeting api level 8 (2.2) or higher you can take one step further and

       webview.getSettings().setBlockNetworkLoads(true);

More: WebSettings | Android Developers

Upvotes: 1

Related Questions