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 !

2
  • Parse has very clear documentation on how queries work for Android here: parse.com/docs/android_guide#queries Commented Sep 23, 2013 at 15:37
  • They are useful, however without many tutorials and examples which makes them pretty hard to understand Commented Sep 23, 2013 at 16:21

1 Answer 1

1

So now you'll have a list of vegetables objects in ob.

Just iterate through ob pulling the price from each one in the list.

for(ParseObject vegetable : ob){
    Log.d("TAG", "price: " + vegetable.getDouble("price"))
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.