我从解析中获取数据时显示ProgressDialog
。并且它应该在完成时解雇,但它没有。
private ProgressDialog progress;
mainAdapter.addOnQueryLoadListener(new ParseQueryAdapter.OnQueryLoadListener<ParseObject>(){
@Override
public void onLoading() {
progress = ProgressDialog.show(this, "Tittle","Message", true);
}
@Override
public void onLoaded(List<ParseObject> parseObjects, Exception e) {
progress.dismiss();
}
});
我已尝试使用线程,我已使用progress.cancel()
和progress.hide()
但由于某种原因ProgressDialog
未关闭并停留在屏幕上,即使在dismiss
命令。
答案 0 :(得分:0)
progress = ProgressDialog.show(this, "Tittle","Message", true);
实际上是
public static ProgressDialog show(Context context, CharSequence title,
CharSequence message, boolean indeterminate) {
return show(context, title, message, indeterminate, false, null);
}
并调用此方法
public static ProgressDialog show(Context context, CharSequence title,
CharSequence message, boolean indeterminate,
boolean cancelable, OnCancelListener cancelListener) {
ProgressDialog dialog = new ProgressDialog(context);
dialog.setTitle(title);
dialog.setMessage(message);
dialog.setIndeterminate(indeterminate);
dialog.setCancelable(cancelable);
dialog.setOnCancelListener(cancelListener);
dialog.show();
return dialog;
}
所以cancelable
是false
。尝试使用
progress = ProgressDialog.show(this, "Tittle","Message", true, true);
希望它有所帮助。