Reputation: 149
I know how to query by distance, it works very well.
The question is: How to get the first 10 closest item, then the 10 after that and so on ?
ParseGeoPoint userLocation = (ParseGeoPoint) userObject.get("location");
ParseQuery<ParseObject> query = ParseQuery.getQuery("PlaceObject");
query.whereNear("location", userLocation);
query.setLimit(10);
query.findInBackground(new FindCallback<ParseObject>() { ... });
Thanks
Upvotes: 0
Views: 185
Reputation: 2364
the setSkip()
method: https://parse.com/docs/android/api/com/parse/ParseQuery.html#setSkip(int)
You could maybe put the query in a method which you call everytime you want to get 10 more results and then increment the skip value by 10.
ParseGeoPoint userLocation = (ParseGeoPoint) userObject.get("location");
ParseQuery<ParseObject> query = ParseQuery.getQuery("PlaceObject");
query.whereNear("location", userLocation);
query.setLimit(10);
query.setSkip(skipNum); //0 the firstTime, 10 the 2nd, 20 the 3rd, etc
query.findInBackground(new FindCallback<ParseObject>() { ... });
Upvotes: 2