我在WebView
應用程序中使用ProgressDialog
。 在onPageStarted
中,我顯示對話框,但在onPageFinished
中使用pd.dismiss
時,應用程序崩潰。應用程序在關閉ProgressDialog時崩潰
web.setWebViewClient(new WebViewClient() {
//Opens all the Clicked Links in App itself.. (No Opera/Browser/Chrome/Uc popup)
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
//Shows a Dialog when there is an Error
@Override
public void onReceivedError(WebView view, int errorcode,String description, String fallingUrl) {
Toast.makeText(getActivity(),"NetWork Error", Toast.LENGTH_SHORT).show();
}
//Showing ProgressBar when Page is Loading
@Override
public void onPageStarted(WebView view,String url , Bitmap favicon){
ProgressDialog pd = new ProgressDialog(getActivity());
pd.setMessage("Loading...");
pd.show();
}
//Hiding ProgressBar when Loading Finished
public void onPageFinished(WebView view,String Url){
pd.dismiss();
}
});
在此處添加崩潰Logcat詳細信息。 – W4R10CK
你能分享你的crash stacktrace嗎?錯誤日誌 –