Code example for WebView

Methods: getSettingssetWebViewClient, setDownloadListener

0
  } 
 
  private WebView page() {
    if (this.page == null) {
      this.page = (WebView)findViewById(R.id.webpage);
      WebSettings s = this.page.getSettings();
      s.setJavaScriptEnabled(true);
      this.page.setWebViewClient(new MyWebViewClient());
      this.page.setDownloadListener(new DefaultDownloadListener());
    } 
    return this.page;
  } 
 
  private class MyWebViewClient extends WebViewClient {
    @Override 
    public boolean shouldOverrideUrlLoading(WebView v, String url) {
      v.loadUrl(url);
      return true; 
    }