我在加載webview對話框時遇到了問題。我的對話是dismis但我必須再次等待一些秒鐘,顯示完整的WebView ..我想的是,如果加載對話框是dismis的WebView做..這是我的WebView代碼:在android中加載對話框
progressBar = new ProgressDialog(this);
webView = (WebView) findViewById(R.id.webView1);
webView.getSettings().setJavaScriptEnabled(true);
webView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
final AlertDialog alertDialog = new AlertDialog.Builder(this).create();
progressBar = ProgressDialog.show(WebViewFacebook.this, "Loading", "Please wait for a moment...");
webView.setWebViewClient(new WebViewClient() {
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
public void onPageFinished(WebView view, String url) {
if (progressBar.isShowing()) {
progressBar.dismiss(); //--> this progressbar always dismis although mw webview not done ><
}
}
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
alertDialog.setTitle("Error");
alertDialog.setMessage(description);
alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
//return;
finish();
}
});
alertDialog.show();
}
});
webView.loadUrl(strurl);
我的問題是loadingdialog dismis雖然網頁流量不這樣做,所以我必須等待一段第二,看網頁...... – 2012-07-19 11:14:53