Add a client to the web view : WebView « UI « Android

Home
Android
1.2D Graphics
2.Animation
3.Core Class
4.Database
5.Date Type
6.Development
7.File
8.Game
9.Hardware
10.Media
11.Network
12.Security
13.UI
14.User Event
Android » UI » WebView 
Add a client to the web view
   

package app.test;

import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebView;
import android.webkit.WebViewClient;

public class Test extends Activity {
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    WebView webview = new WebView(this);
    webview.getSettings().setJavaScriptEnabled(true);
    // 
    webview.setWebViewClient(new WebViewClient());
    webview.loadUrl("http://www.google.com");
    setContentView(webview);
  }
}

   
    
    
  
Related examples in the same category
1.Adding WebView to Activity, load URL and grab focus
2.Load local resource into WebView
3.Enable Javascript for WebView
4.Load remote web page for WebView
5.extends WebViewClient and check the url
6.Using WebView to load url
7.Using WebView to load static html string
8.Load static html file into WebView
9.Load Url to WebView
10.Load image from remote host to WebView
11.Sample creating 10 webviews.
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.