进度对话计数器
我正在尝试在加载网页视图时使用进度对话框,并且希望它在网页加载完成后消失。这是一个棘手的情况,因为我有 3 个选项卡,其中都有 Web 视图,而且这是一项活动。有人可以帮助我处理我的代码吗:
if("TAB_2".equals(tabId)) {
ProgressDialog pd = ProgressDialog.show(mainmenu.this, "", "Loading. Please wait...", true);
int progress1 = 1;
while(progress1 < 100) {progress1 = webview2.getProgress();}
if(progress1 > 99) {pd.dismiss();}
}
我在这里做错了什么?
I am trying to use a progress dialog while my webview is loading and I want it to disappear when the webpage is done loading. It is a tricky situation since I have 3 tabs all with webviews in them and it is one activity. Can someone help me with my code:
if("TAB_2".equals(tabId)) {
ProgressDialog pd = ProgressDialog.show(mainmenu.this, "", "Loading. Please wait...", true);
int progress1 = 1;
while(progress1 < 100) {progress1 = webview2.getProgress();}
if(progress1 > 99) {pd.dismiss();}
}
What am I doing wrong here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尼克……嗯。我发现您的任务可能涉及更新用户界面。您可以将处理程序附加到您的 Activity 并每秒循环检查 UI 以查看它是否已完成更新。完成后,您可以关闭进度对话框。
Nick... Hmmm. I see that your task may involve updating the UI. You can attach a handler to your activity and loop every second checking the UI to see if it is done updating. When it is done you can dismiss the progressdialog.