Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android

Parse Query, How to create a query that checks if arrays contain a particular string

I am using Parse.Com's backend service.

I am currently trying the code below:

I've tried a few variations and nothing seems to work. Is this even possible?

`ArrayList cities = new ArrayList<>(1); cities.add(OriginCity); cities.add(EndCity);

ParseQuery mpassthroughcities = ParseQuery.getQuery("Ride"). whereContainsAll("Cities", cities). whereGreaterThanOrEqualTo("Date", mCurrentDate);`

After the following code runs, I use cities I know are contained within "Cities" and I get nada.

Please help, will repay in karma.

1 Answer

I think your problem is the definition of the arrayList missing the type of listItem. this may helps you:

ArrayList<Integer> numbers = new ArrayList<Integer>();
numbers.add(2);
numbers.add(3);
numbers.add(4);
query.whereContainsAll("arrayKey", numbers);