您的位置:首页 > 移动开发

判断webview加载完毕

2013-08-27 21:22 369 查看
package
com.jouhu;


import
android.app.Activity;


import
android.app.ProgressDialog;


import
android.os.Bundle;


import
android.webkit.WebView;


import
android.webkit.WebViewClient;


public
class
WebViewFinishedActivity
extends
Activity {


/** Called when the activity is first created. */


WebView wv =
null
;


ProgressDialog pd =
null
;


@Override


public
void
onCreate(Bundle savedInstanceState) {


super
.onCreate(savedInstanceState);


setContentView(R.layout.main);


wv = (WebView)findViewById(R.id.webView1);


if
(wv !=
null
)


{


wv.setWebViewClient(
new
WebViewClient()


{


@Override


public
void
onPageFinished(WebView view,String url)


{


pd.dismiss();


}


});


loadUrl(
"http://www.sohu.com"
);


}


}


public
void
loadUrl(String url)


{


if
(wv !=
null
)


{


wv.loadUrl(url);


pd = ProgressDialog.show(
this
,
"导购系统"
,
"系统加载中..."
);


wv.reload();


}


}


}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: