Android 连接丢失后如何停止进度条旋转
How to stop progressbar spinning after connection has been lost in Android
当我按下手机上的后退按钮时 phone 然后我关闭了 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);
}
}
}
尝试设置进度条cancelable
属性。
mProgressDialog = new ProgressDialog(this);
mProgressDialog.setCancelable(true);
当我按下手机上的后退按钮时 phone 然后我关闭了 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);
}
}
}
尝试设置进度条cancelable
属性。
mProgressDialog = new ProgressDialog(this);
mProgressDialog.setCancelable(true);