【发布时间】:2016-04-19 03:56:36
【问题描述】:
当我按下手机上的返回按钮后,我关闭了 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);
}
}
}
【问题讨论】:
-
试试 mProgressDialog .dismiss();
-
不要使用
.hide,如@saeed 所说,使用.dismiss。尤其是当finish被执行时。
标签: java android android-progressbar