CQM CQM - 2 months ago 73
Android Question

Android webview slow

My android webviews are slow. This is on everything from phones to 3.0+ tablets with more than adequate specs

I know that webviews are supposed to be "limited" but I see web apps done with phone gap that must be using all sorts of CSS3 and JQuery sorcery, they run just fine and speedy

so I'm missing something, is there some kind of

that I can use to speed things up? Thanks

also, sometimes the contents of my webview just simply don't load, instead of slowly loading, it just wont load. The asset I am testing with is stored locally, no errors.


It depends on the web application being loaded. Try some of the approaches below:

Set higher render priority (deprecated from API 18+):


Enable/disable hardware acceleration:

if (Build.VERSION.SDK_INT >= 19) {
    // chromium, enable hardware acceleration
    webView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
} else {
    // older android version, disable hardware acceleration
    webView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);

Disable the cache: