Code example for WebView: Displaying web pages

Methods: addJavascriptInterfacegetSettingsloadUrlsetScrollBarStylesetWebChromeClient

0
		//locationHelper = new LocationHelper(this); 
		//locationHelper.registerForUpdates(this); 
		 
		//Setup WebView 
		mWebView = (WebView) findViewById(R.id.webview);
		mWebView.getSettings().setJavaScriptEnabled(true);
		mWebView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
		 
		//Add any JS interfaces that we need like the DB 
		mWebView.addJavascriptInterface(new LocalDBInterface(this), "AndroidDB");
		 
		//Load the URL from the assets folder. 
		mWebView.loadUrl("file:///android_asset/index.html");
		 
		//Set up Error Logging. 
		mWebView.setWebChromeClient(new WebChromeClient(){
			public void onConsoleMessage(String message, int lineNumber, String sourceID){
				Log.d("HTMl5Game",message + " -- LINE: " + lineNumber + " : " + sourceID);
			} 
			 
		});