与查询Parse.com获取价值 [英] Parse.com get value with query

查看:120
本文介绍了与查询Parse.com获取价值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找一个例子就如何使用Parse.com查询。它已经真正含糊。 我觉得应该先从:

I've been looking for an example on how to use Parse.com queries. It's been really vague. I think it should start with:

ParseQuery query=ParseQuery.getQuery(<Class(aka table name)>);

但后来,我有不知道。你可以这样做

But then, i've got no idea. You can do something like

query.whereEqualsTo(<collumn>,value)

在这种情况下,我得到的'价值'回来,如果它的存在。 我所试图做的是。我得到了collumns标识和名称的表格。 我知道这个ID是什么,它​​是0。所以现在我想知道是什么名字属于ID = 0 .. 但是,我应该用什么样的查询,我不知道......

In that case i get the 'value' back if it exists. What I am trying to do is. I got a table with the collumns ID and Name. I know what the ID is, it is 0. So now I want to know what Name belongs to the ID = 0.. But what query should I use, I have no idea ...

推荐答案

解析的Andr​​oid指南有一个基本的查询,例如这里这将返回匹配的约束的第一个对象:

Parse's Android Guide has a basic query example here which will return the first object which matches your constraints:

ParseQuery<ParseObject> query = ParseQuery.getQuery("YourClassName");
query.whereEqualTo("ID", "someID");
query.getFirstInBackground(new GetCallback<ParseObject>() {
  public void done(ParseObject object, ParseException e) {
    if (object == null) {
      Log.d("score", "The getFirst request failed.");
    } else {
      Log.d("score", "Retrieved the object.");
    }
  }
});

这篇关于与查询Parse.com获取价值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆