Code example for WebView: Displaying web pages

Methods: addJavascriptInterfacegetSettingsloadUrlsetNetworkAvailablesetWebChromeClientsetWebViewClient, setHorizontalScrollBarEnabled, setScrollbarFadingEnabled, setVerticalScrollBarEnabled

0
         
 
         
        mContext = this;
       	mWebView = (WebView)findViewById(R.id.webView1);
		WebSettings ws = mWebView.getSettings();
		ws.setJavaScriptEnabled(true); 
		ws.setPluginsEnabled(true);
 		ws.setCacheMode(WebSettings.LOAD_NO_CACHE);
 		ws.setDomStorageEnabled(true);
 		ws.setAppCacheEnabled(true);
 		ws.setSaveFormData(true);
 		 
 		mWebView.setNetworkAvailable(true);
		mWebView.setWebChromeClient(new ChromeClient(this));
		mWebView.setWebViewClient( new webviewClient(this) );
		mWebView.addJavascriptInterface(new NativeBridge(), "NativeBridge");
		mWebView.setScrollbarFadingEnabled(true);
		mWebView.setVerticalScrollBarEnabled(false);
		mWebView.setHorizontalScrollBarEnabled(false);		
		String strUrl = "file:///android_asset/www/index.html";
	    mWebView.loadUrl(strUrl);
	    prgrBar = new ProgressBar(this);    
	} 
     
    @Override 
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
Stop searching for code, let great code find you!  Add Codota to your java IDE