Code example for WebView: Displaying web pages

Methods: getSettingsloadUrlsetVerticalScrollbarOverlaysetWebChromeClientsetWebViewClient, setHorizontalScrollBarEnabled, setVerticalScrollBarEnabled

0
		myWebview = (WebView) findViewById(R.id.webview_map);
		if (savedInstanceState != null)
			myWebview.restoreState(savedInstanceState);
 
		try { 
			WebSettings s = myWebview.getSettings();
			s.setJavaScriptEnabled(true);
			s.setPluginsEnabled(true);
			s.setNeedInitialFocus(false);
			s.setSupportZoom(true);
			myWebview.setHorizontalScrollBarEnabled(false);
			myWebview.setVerticalScrollBarEnabled(true);
			myWebview.setVerticalScrollbarOverlay(true);
			myWebview.setWebChromeClient(new chromeClient());
			myWebview.setWebViewClient(new webViewClient());
 
			s.setUserAgentString(s.getUserAgentString() + " SogouNovel Android");
			s.setPluginState(PluginState.OFF);
			s.setLoadsImagesAutomatically(PreferenceManager
					.getDefaultSharedPreferences(this).getBoolean(
							"loadImageState", true)); 
			s.setUseWideViewPort(true);
			s.setLoadWithOverviewMode(true);
			s.setBuiltInZoomControls(true);//
			s.setAppCacheEnabled(true);
			s.setSaveFormData(true);
			s.setSavePassword(true);
			s.setGeolocationEnabled(true);
			s.setGeolocationDatabasePath("/data/data/com.sogou.activit.src/databases/");
			s.setDomStorageEnabled(true);
		} catch (Exception e) {
			e.printStackTrace();
		} 
		if (orginalUrl != null) {
			myWebview.loadUrl(orginalUrl);
		} else { 
			WebViewActivity.this.finish();
		} 
 
		ImageView back = (ImageView) findViewById(R.id.web_back);
Stop searching for code, let great code find you!  Add Codota to your java IDE