之后,当我按下手机上的后退按钮时,我关闭了wifi或移动数据网络。
进度栏旋转不会停止,并且后退按钮不起作用。
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 we are updating records ...", true);
}
}
}
最佳答案
尝试设置progressbar的cancelable
属性。
mProgressDialog = new ProgressDialog(this);
mProgressDialog.setCancelable(true);
关于java - 在Android中失去连接后如何停止进度条旋转,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/36708271/