解析Android查询不起作用

时间:2014-07-17 00:12:13

标签: parse-platform

我正在尝试从Parse Class测试中获取数据,但我无法通过以下代码获取任何内容。请帮忙!谢谢!

@Override
    protected Void doInBackground(Void... params) {
        ParseQuery<ParseObject> query = new ParseQuery<ParseObject>("Test");

        try {
            items = query.find();
            Log.d("count", query.count() + " items");
        } catch (ParseException e) {
        }
        return null;
    }

1 个答案:

答案 0 :(得分:0)

看起来你在这里混合了Android和JavaScript语法。基本的例子是:

ParseQuery<ParseObject> query = ParseQuery.getQuery("GameScore");
query.whereEqualTo("playerName", "Dan Stemkoski");
query.findInBackground(new FindCallback<ParseObject>() {
    public void done(List<ParseObject> scoreList, ParseException e) {
        if (e == null) {
            Log.d("score", "Retrieved " + scoreList.size() + " scores");
        } else {
            Log.d("score", "Error: " + e.getMessage());
        }
    }
});

文档:https://parse.com/docs/android_guide#queries