Android Progress Bar is not dismissed

前端 未结 1 403
悲哀的现实
悲哀的现实 2021-01-28 00:03

I am using Progress Dialog to show progress while loading web page, but sometimes it does not work properly. Progress Dialog never get dismissed though page is loaded.

I

相关标签:
1条回答
  • 2021-01-28 00:51

    android_dev , Use a handler

        public void onPageFinished(WebView view, String url) 
        { 
        handler.sendEmptyMessage(0);
        }
    
        Handler handler = new Handler() {
          @Override
          public void handleMessage(Message msg) {
         if(progressdialog.isShowing() || progressdialog!=null)
         progressdialog.dismiss();
         progressdialog=null;
          }
        }
    

    & you are done!

    0 讨论(0)
提交回复
热议问题