当我按下手机上的后退按钮后,我关闭了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);