我只是被困在一个小东西大约1整天我创建了一个 webview android 应用程序,它的工作正常,但我想要一个进度对话框,基本上出现在下一页加载时。这是我的代码
//ProgressDialogue
ProgressDialog pd = null;
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
pd=new ProgressDialog(MainActivity.this);
pd.setTitle("Please Wait..");
pd.setMessage("Your Internet is Slow..");
pd.show();
super.onPageStarted(view, url, favicon);
}
@Override
public void onPageFinished(WebView view, String url) {
pd.dismiss();
super.onPageFinished(view, url);
}
请帮我解决这个问题并告诉我错误 我确实导入了 android.app.ProgressDialog;
答案 0 :(得分:0)
ProgressDialog pd; //Global
pd=new ProgressDialog(MainActivity.this); // OnCreate
pd.setTitle("Please Wait..");
pd.setMessage("Your Internet is Slow..");
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
super.onPageStarted(view, url, favicon); // Should be First
pd.show();
}
@Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url); //Should be First
pd.dismiss();
}