Reputation: 109
I have 2 users in the User class and they have ParseGeoPoint Column which I want to access. Those GeoPoints get updated with user's current latlng. I am allowing a user to manually add another person to see their location on the map. After the user give a username, this is what I've tried to get it's location:
ParseQuery<ParseObject> parseQuery = ParseQuery.getQuery("User");
parseQuery.whereEqualTo("username", username);
parseQuery.setLimit(1);
parseQuery.findInBackground(new FindCallback<ParseObject>() {
@Override
public void done(List<ParseObject> objects, ParseException e) {
if(e == null)
{
Toast.makeText(MapsActivity.this, objects.size() + " users found!", Toast.LENGTH_SHORT).show();
}else
{
Toast.makeText(MapsActivity.this, e.toString(), Toast.LENGTH_SHORT).show();
}
}
});
No matter what I do, I always get objects.size() as 0. I have tried hard-coding the username but still I get same results. Any help is greatly appreciated.
P.S This is my first time using Parse so be gentle.
Upvotes: 0
Views: 126
Reputation: 2145
ParseQuery<ParseUser> query = ParseUser.getQuery();
query.whereEqualTo("username", username);
query.findInBackground(new FindCallback<ParseUser>() {
public void done(List<ParseUser> objects, ParseException e) {
if (e == null) {
// The query was successful.
} else {
// Something went wrong.
}
}
});
Try this code
Upvotes: 3