android - Retrieve email address from Parse User class -


i trying email address of user parse database using objectid.

parsequery query = parseuser.getquery();         query.whereequalto("objectid", "emqw4toq0c");         query.getinbackground("email",new getcallback() {          @override         public void done(parseobject parseobject, parseexception e) {             email= parseobject.getstring("email");         }     });         }     }); 

i trying use getinbackground() method gives error.

03-29 02:13:33.600  19659-19659/com.parse.starter e/androidruntime﹕ fatal exception: main     java.lang.runtimeexception: unable start activity componentinfo{com.parse.starter/com.parse.starter.mainactivity}: java.lang.nullpointerexception: println needs message             @ android.app.activitythread.performlaunchactivity(activitythread.java:2295)             @ android.app.activitythread.handlelaunchactivity(activitythread.java:2349)             @ android.app.activitythread.access$700(activitythread.java:159)             @ android.app.activitythread$h.handlemessage(activitythread.java:1316)             @ android.os.handler.dispatchmessage(handler.java:99)             @ android.os.looper.loop(looper.java:176)             @ android.app.activitythread.main(activitythread.java:5419)             @ java.lang.reflect.method.invokenative(native method)             @ java.lang.reflect.method.invoke(method.java:525)             @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:1046)             @ com.android.internal.os.zygoteinit.main(zygoteinit.java:862)             @ dalvik.system.nativestart.main(native method)      caused by: java.lang.nullpointerexception: println needs message             @ android.util.log.println_native(native method)             @ android.util.log.d(log.java:155)             @ com.parse.starter.dummy.getemail(dummy.java:54)             @ com.parse.starter.mainactivity.oncreate(mainactivity.java:28)             @ android.app.activity.performcreate(activity.java:5372)             @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1104)             @ android.app.activitythread.performlaunchactivity(activitythread.java:2257)             at android.app.activitythread.handlelaunchactivity(activitythread.java:2349)             at android.app.activitythread.access$700(activitythread.java:159)             at android.app.activitythread$h.handlemessage(activitythread.java:1316)             at android.os.handler.dispatchmessage(handler.java:99)             at android.os.looper.loop(looper.java:176)             at android.app.activitythread.main(activitythread.java:5419)             at java.lang.reflect.method.invokenative(native method)             at java.lang.reflect.method.invoke(method.java:525)             at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:1046)             at com.android.internal.os.zygoteinit.main(zygoteinit.java:862)             at dalvik.system.nativestart.main(native method) 

any suggestions?

try this:

parsequery<parseuser> query = parseuser.getquery();         query.getinbackground("emqw4toq0c",new getcallback<parseuser>() {          @override         public void done(parseuser parseobject, parseexception e) {             email= parseobject.getemail();         }     });         }     }); 

there 3 differences:

  1. the first parameter getinbackground object id
  2. the query specifies return parseuser
  3. there special method user's email address

Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -