在我的Fragment中,ParseQuery成功查询如下:
comments = new ParseQuery<ParseObject>("CommentItem");
comments.setLimit(99);
comments.whereEqualTo("parentUser", feedUserName);
comments.whereEqualTo("parentFeed", feedItem);
comments.findInBackground(new FindCallback<ParseObject>() {
@Override
public void done(List<ParseObject> mobjects, ParseException e) {
if(e == null){
for(ParseObject object : objects){
}
}
}
});
但是,如果连接速度很慢,则在查询之前只能看到背景。如何在加载解析查询时显示加载符号?
答案 0 :(得分:0)
您需要在执行findInBackground之前显示进度对话框并在回调中将其关闭。 所以你的代码应如下所示:
comments = new ParseQuery < ParseObject > ("CommentItem");
comments.setLimit(99);
comments.whereEqualTo("parentUser", feedUserName);
comments.whereEqualTo("parentFeed", feedItem);
// show progres dialog
final ProgressDialog myDialog = ProgressDialog.show(this, "Loading...","Loading Results...", true);
comments.findInBackground(new FindCallback < ParseObject > () {@
Override
public void done(List < ParseObject > mobjects, ParseException e) {
myDialog.dismiss(); // remove progress dialog on finish
if (e == null) {
for (ParseObject object: objects) {
}
}
}
});
&#13;
祝你好运。