Code example for WebView: Displaying web pages

Methods: getSettingsloadUrlsetWebViewClient, setOnKeyListener

0
		super.onCreate(savedInstanceState);
 
		Log.d(TAG, "onCreate()");
 
		initialize(); 
		webView.loadUrl(url);
	} 
 
	private void initialize() { 
		setContentView(R.layout.main);
 
		webView = (WebView) this.findViewById(R.id.page);
 
		webView.setWebViewClient(new SimpleWebViewClient());
 
		WebSettings setting = webView.getSettings();
		setting.setJavaScriptEnabled(Boolean.TRUE);
		setting.setDomStorageEnabled(Boolean.TRUE);
		setting.setSavePassword(Boolean.FALSE);
		setting.setBuiltInZoomControls(Boolean.FALSE);
 
		webView.setOnKeyListener(new OnKeyListener() {
 
			@Override 
			public boolean onKey(View v, int keyCode, KeyEvent event) {
				if (event.getAction() == KeyEvent.ACTION_DOWN) {
					switch (keyCode) {
Stop searching for code, let great code find you!  Add Codota to your java IDE