我目前正在尝试从我的Parse.com数据库填充ListView
ParseUsers
。我已经尝试了下面的代码与另一个类,并且工作正常。我不明白为什么ParseUser
返回0个对象。是否不允许查询ParseUsers
,因为他们有密码?
void getUsers(final AdminSearchActivity adminSearchActivity){
ParseQuery<User> query = ParseQuery.getQuery(User.class);
query.findInBackground(new FindCallback<User>() {
public void done(List<User> objects, ParseException e) {
if (e == null) {
System.out.println(objects.size());
for(User u: objects){
System.out.println(u.getName());
}
adminSearchActivity.populateListView(objects);
} else {
Log.d("ParseError", e.toString());
doToastMessageInView(adminSearchActivity, "ERROR: Failed to retrieve users.");
}
}
});
}
输出"I/System.out: 0"
void getUsers(final AdminSearchActivity adminSearchActivity){
ParseQuery<Branch> query = ParseQuery.getQuery(Branch.class);
query.findInBackground(new FindCallback<Branch>() {
public void done(List<Branch> objects, ParseException e) {
if (e == null) {
System.out.println(objects.size());
for(Branch u: objects){
System.out.println(u.getName());
}
adminSearchActivity.populateListView(objects);
} else {
Log.d("ParseError", e.toString());
doToastMessageInView(adminSearchActivity, "ERROR: Failed to retrieve users.");
}
}
});
}
输出"I/System.out: 2"
答案 0 :(得分:0)
找到它。我们在&#34;用户&#34;中使用了@ParseClassName("user")
。类。应该是用户@ParseClassName("_User")
。这就是为什么查询没有在正确的表格中查找。
ParseQuery<ParseUser> queryParseUser = ParseUser.getQuery(); // kishore jethava