java - how to stop progressbar spining after connection has been lost in android -


when pressed button on mobile phone after switch off wifi or mobile data network.

progress bar spinning not stop , button not work.

    protected void onrefreshingstatechanged(boolean refreshing) {     super.onrefreshingstatechanged(refreshing);      if (!refreshing){         if (mprogressdialog != null && isbackpressed){             mprogressdialog.hide();             mprogressdialog = null;             this.setresult(result_ok, getintent());             finish();         }      }else{         if (mprogressdialog == null && isbackpressed){             mprogressdialog = progressdialog.show(this, "fetching data",                     "please wait while updating records ...", true);         }     } } 

any appreciated.

try set cancelable property of progressbar.

mprogressdialog = new progressdialog(this); mprogressdialog.setcancelable(true); 

Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -