0

I am new to parse.com and databases in general.

For my android app, I need to search if an object is available and if so, then it should give me its price. So my class is vegetables, and it has a column called 'isAvailable' and another column called 'price'

ParseQuery<ParseObject> query = new ParseQuery<ParseObject>("vegetables");
query.whereEqualTo("isAvailable", true); try {
    ob = query.find();
}
catch (ParseException e) {
    Log.e("Error", e.getMessage());
    e.printStackTrace();
}

So, now I do have a list of all the vegetables that are available, but how do I query the price? I was thinking of using the whereMatchesQuery(key, query) but it doesnt make too much sense on how to use it.

Could you guide me so as to what I should be doing, thanks !

4

1 回答 1

1

所以现在你将在 ob 中有一个蔬菜对象列表。

只需遍历 ob 从列表中的每个拉取价格即可。

for(ParseObject vegetable : ob){
    Log.d("TAG", "price: " + vegetable.getDouble("price"))
}
于 2013-09-23T15:37:03.960 回答