0

I'm using the following iOS Parse query:

let predicate = NSPredicate(format: "(fromUserid = %@ OR fromUserid = %@) AND (toUserid = %@ OR toUserid = %@) AND seen = %@", profilePhotoID, friendProfilePhotoID, profilePhotoID, friendProfilePhotoID, false)
var query = PFQuery(className: "Message", predicate: predicate)

How can I do the same query using the Parse Android SDK? I don't see an option to do predicates like that.

1 Answer 1

3

You can query data from parse in android SDK is like given example...

        ParseQuery<ParseObject> query = ParseQuery.getQuery("Message");
        String[] ids = {profilePhotoID, friendProfilePhotoID};
        query.whereContainedIn("fromUserid", Arrays.asList(ids));
        query.whereContainedIn("toUserid", Arrays.asList(ids));
        query.whereEqualTo("seen",  false);
        query.findInBackground(new FindCallback<ParseObject>() {
            public void done(List<ParseObject> scoreList, ParseException e) {
                if (e == null) {
                    Log.d("Message", "Retrieved " + scoreList.size() + " Message");
                } else {
                    Log.d("Message", "Error: " + e.getMessage());
                }
            }
        });

For more details please refer Parse Query Document

let me know if anything needed..

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.