android - Retrieve data from a class in Parse.com -
i have class in parse.com, xyz, , has columns email, password, phone, age. have email , password combination , want check whether there such combination in class? how do this?
i have class donate, , have been given email(e) , password(pw). here goes code:
`parsequery<parseobject> query = parsequery.getquery("donate"); query.whereequalto("email", e); query.whereequalto("password", pw); query.findinbackground(new findcallback<parseobject>() { @override public void done(list<parseobject> list, parseexception e) { if (e == null) { toast.maketext(getapplicationcontext(), "success!!!", toast.length_long).show(); } else { toast.maketext(getapplicationcontext(), "something went wrong!!!", toast.length_long).show(); } } }); `
and shows 'success' irrespective of strings e, , pw.
parsequery return parseexception if there technical issue calling server. else, though query doesn't find looked for, return empty list , 'e' var null. need :
parsequery<parseobject> query = parsequery.getquery("donate"); query.whereequalto("email", e); query.whereequalto("password", pw); query.findinbackground(new findcallback<parseobject>() { @override public void done(list<parseobject> list, parseexception e) { if (e == null) { if (list.isempty() == false) { // add toast.maketext(getapplicationcontext(), "success!!!", toast.length_long).show(); }else{ toast.maketext(getapplicationcontext(), "worng password!!!", toast.length_long).show(); // add } } else { toast.maketext(getapplicationcontext(), "something went wrong!!!", toast.length_long).show(); } } });
Comments
Post a Comment