Android Parse Login with email or username -


i'm trying make android app using parse allows 1 login using either username or email. have tried querying object provided email address, object's username login with. however, getting error:

'getfirstinbackground(com.parse.getcallback)' in 'com.parse.parsequery' cannot applied '(anonymous com.parse.getcallback "com.parse.parseobject>)'

i'm new app dev , parse, i'm not entirely sure means. understand wont let me use getfirstinbackground because works parseuser's , i'm working parseobjects, code i'm using pulled prior stackoverflow question working answer: login username , email in parse android

here code:

            // allow username or email log in         if (memail.indexof("@") != -1) {             parsequery<parseuser> query = parseuser.getquery();             query.whereequalto("email", memail);             query.getfirstinbackground(new getcallback<parseobject>() {                 public void done(parseobject object, parseexception e) {                     if (object == null) {                         log.d("score", "the getfirst request failed.");                     } else {                          string actualusername = object.getstring("username");                         parseuser.logininbackground(actualusername, mpassword, new logincallback() {                             @override                             public void done(parseuser parseuser, parseexception e) {                                 if (e != null) {                                     // todo: show error message                                     toast.maketext(loginactivity.this, "credentials incorrect", toast.length_long).show();                                 } else {                                     // start intent activity                                     // todo: choose activity                                     intent intent = new intent(loginactivity.this, mainactivity.class);                                     startactivity(intent);                                 }                             }                         });                     }                 }             }); 

according docs, method's signature follows:

class com.parse.parsequery<t> {     public void getfirstinbackground(getcallback<t> callback) } 

that means generic type of getcallback must same in parsequery. should be

query.getfirstinbackground(new getcallback<parseuser>()) { /* ... */ } 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -