A Quick note on WebView

A View that displays web pages. This class is the basis upon which you can roll your own web browser or simply display some online content within your Activity. It uses the WebKit rendering engine to display web pages and includes methods to navigate forward and backward through a history, zoom in and out, perform text searches and more.

Note that, in order for your Activity to access the Internet and load web pages in a WebView, you must add the INTERNET permissions to your Android Manifest file:

<uses-permission android:name="android.permission.INTERNET" />

Improve WebView Performance

Follow these simple coding tricks to improve Android WebView Performance.

        WebView mWebView = new WebView(this);
        WebSettings settings = mWebView.getSettings();
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            mWebView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
        } else {
            mWebView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);

Try these and check if your content is loading faster in Android WebView.

Please send your comments to coderzheaven@gmail.com.


One Comment

  1. Felipe Lazo April 12, 2018 at 7:37 pm

    This is gold, even in 2018. I used some of those (the ones I could easily implement at NativeScript) and the change was notorious. A million thanks.


Leave a Reply

Your email address will not be published. Required fields are marked *




Theme by HermesThemes

Copyright © 2018 CoderzHeaven. All Rights Reserved

Please wait...

Subscribe to our newsletter

Want to be notified when our article is published? Enter your email address and name below to be the first to know.