Code example for WebView: Displaying web pages

Methods: addJavascriptInterfacegetSettingsloadUrlsetWebChromeClientsetWebViewClient, requestFocus

0
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
 
		webView = (WebView) findViewById(R.id.webkit);
		webView.getSettings().setJavaScriptEnabled(true);
		webView.requestFocus();
		webView.setWebChromeClient(new WebChromeClient());
	 
		webView.setWebChromeClient(new MyWebChromeClient());
		webView.addJavascriptInterface(new DemoJavaScriptInterface(), "demo");
		 
		// �����¿�Android��ϵͳbrowser����Ӧ������ 
		webView.setWebViewClient(new WebViewClient(){   
		    public boolean shouldOverrideUrlLoading(WebView view, String url) {   
		        view.loadUrl(url);   
		        return true;     
		    }    
		});  
 
		webView.loadUrl("file:///android_asset/AN/index.html");
	} 
 
	final class DemoJavaScriptInterface { 
		DemoJavaScriptInterface() { 
		}