package gongzibai.co.cc;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Toast;

public class WebView2Activity extends
Activity {

private ProgressDialog progressBar;
WebView webview;
AlertDialog alertDialog;

/** Called when the activity is first created. */
@Override
public void onCreate(
Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
webview = (WebView) findViewById(R.id.webview);
progressBar = ProgressDialog
.show(WebView2Activity.this,
null,
"正在进入网页,请稍后

…");
webview.getSettings()
.setJavaScriptEnabled(
true);

webview.loadUrl(" http://www.qq.com");

AlertDialog alertDialog = new AlertDialog.Builder(
this).create();

// 设置视图客户端
webview.setWebViewClient(new MyWebViewClient());

}

class MyWebViewClient extends
WebViewClient {

@Override
public boolean shouldOverrideUrlLoading(
WebView view, String url) {
// TODO Auto-generated method stub

view.loadUrl(url);
return super
.shouldOverrideUrlLoading(
view, url);
}

public void onPageFinished(
WebView view, String url) {
// TODO Auto-generated method stub
if (progressBar.isShowing()) {
progressBar.dismiss();

}
}
}
}

作者:gongzibai 发表于2012-7-23 0:31:58 原文链接 阅读:13 评论:0 查看评论

更多相关文章

  1. Android(安卓)Power Management【by Steve Guo】
  2. Appcelerator Cloud Push Notification in Android
  3. Appcelerator Cloud Push Notification in Android
  4. Android(安卓)UI控件详解-GridView(网格视图)
  5. API 25 (Android(安卓)7.1.1 API) widget.Spinner
  6. LowMemoryKiller in Android
  7. 【转】Android(安卓)SDK版本与API Level对照表
  8. Android上运行QT项目Necessitas的基本原理
  9. Android(安卓)简单视图

随机推荐

  1. android布局属性
  2. Android(安卓)通过Socket 和服务器通讯
  3. 详解ImageView的CENTER_CROP,CENTER_INSI
  4. android 开发不容错过的网站
  5. android 中margin,padding,border的区别
  6. 安卓开发笔记(三)android 相对布局属性
  7. Android之布局属性归纳
  8. Android Framework(I)Android Spring Jso
  9. Android中layout属性大全
  10. android总结