Code example for WebView: Displaying web pages

Methods: getSettingsloadDataWithBaseURLloadUrlrestoreStatesetWebChromeClientsetWebViewClient

0
		setContentView(R.layout.web_view_screen);
		 
		instance = this;
		webView = (WebView) findViewById(R.id.webView);
		if(savedInstanceState != null) {
			webView.restoreState(savedInstanceState); 
			}else{} 
		Intent intent = getIntent();
		if (intent.hasExtra(VideoListActivity.BK_VIDEO_URL)){
			 
		String videoURLString = intent.getExtras().getString(VideoListActivity.BK_VIDEO_URL);
//		Toast.makeText(this, "Got videoURL "+videoURLString, Toast.LENGTH_SHORT).show(); 
		 
		webView.getSettings().setJavaScriptEnabled(true);
		webView.getSettings().setDomStorageEnabled(true);
		WebChromeClient webChromeClient = new WebChromeClient(){
			   public void onProgressChanged(WebView view, int progress) {
				    
				   instance.setProgress(progress * 1000);
				   } 
				 }; 
				  
		webView.setWebChromeClient(webChromeClient);
		WebViewClient webViewClient = new WebViewClient() {
			   public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
				     Toast.makeText(instance, "Error occures! " + description, Toast.LENGTH_SHORT).show();
				   } 
				 }; 
		webView.setWebViewClient(webViewClient);
    	webView.getSettings().setPluginState(WebSettings.PluginState.ON);
    	webView.getSettings().getUserAgentString();
    	 
//    	webView.getSettings().setUserAgentString("Android Mozilla/5.0 AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30 Chrome/10.0.648.204"); 
    	Log.d(LOG_TAG,"getUserAgentString = "+ webView.getSettings().getUserAgentString());
    	if (intent.hasExtra(VideoListActivity.BK_VIDEO_IFRAME)){
//    		webView.loadData(videoURLString, "text/html", "utf-8"); 
    		final String mimeType = "text/html";
    	    final String encoding = "UTF-8";	
    		webView.loadDataWithBaseURL("", videoURLString, mimeType, encoding, "");
    	}else{ 
    		webView.loadUrl(videoURLString);
		} 
		} 
	} 
	@Override 
	protected void onSaveInstanceState(Bundle outState) {