Code example for WebSettings

Methods: setJavaScriptEnabled, setPluginsEnabled, setSupportZoom

0
        addContentView(layout, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
        layout.addView(mWebView, new FrameLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT, Gravity.NO_GRAVITY));
        // Basic settings of WebView. 
        WebSettings webSettings = mWebView.getSettings();
        webSettings.setSupportZoom(false);
        webSettings.setJavaScriptEnabled(true);
        webSettings.setPluginsEnabled(true);
        //webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE); 
        // Set a dummy WebViewClient (which enables loading a new page in own WebView). 
        mWebView.setWebViewClient(new WebViewClient(){});
        // Add a progress bar. 
        mProgress = new ProgressBar(this, null, android.R.attr.progressBarStyleHorizontal);
        layout.addView(mProgress, new FrameLayout.LayoutParams(LayoutParams.FILL_PARENT, 5));
        mProgress.setMax(100);
        mProgress.setVisibility(View.GONE);
        mWebView.setWebChromeClient(new WebChromeClient() {
            public void onProgressChanged(WebView view, int progress) {
                if (progress < 100) {
                    mProgress.setVisibility(View.VISIBLE);
                    mProgress.setProgress(progress);
                } else {