android - how to find a user in a ParseUser object -
hi wondering why code not work. trying query parseuser's username field find user keeps saying cant find it.
private void findusername(string user) { // query user database find passed in user parsequery query = parseuser.getquery(); query.whereequalto("username", user); query.findinbackground(new findcallback() { @override public void done(list<parseobject> objects, parseexception e) { founduser = (objects.size() != 0); } }); }
here method calls it
if (!founduser) { errormessage.settext("invalid user name"); }
founduser field because couldnt return in method...
parse treats user objects separate parse objects. should use list<parseuser>
instead of list<parseobject>
. parse android guide provides example https://parse.com/docs/android_guide#users-querying. here parse example clause.
parsequery<parseuser> query = parseuser.getquery(); query.whereequalto("username", user); query.findinbackground(new findcallback<parseuser>() { public void done(list<parseuser> objects, parseexception e) { if (e == null) { // query successful. } else { // went wrong. } } });
Comments
Post a Comment