android - Firebase username email and password registration -


this registration code , not know how separate 2 functions. when run code, following error:

*operation=validateauthserviceoperation java.lang.nullpointerexception: onpostinitcomplete can called once per call getremoteservice 

private void registeruser() {   //getting email , password edit texts final string email = edittextemail.gettext().tostring().trim(); string password = edittextpassword.gettext().tostring().trim();  //checking if email , passwords empty if (textutils.isempty(email)) {     toast.maketext(this, "please enter email", toast.length_long).show();     return; }  if (textutils.isempty(password)) {     toast.maketext(this, "please enter password", toast.length_long).show();     return; }  //if email , password not empty //displaying progress dialog     registerprogressdig.setmessage("registering please wait..."); registerprogressdig.show();    // register user  firebaseauth.getinstance().createuserwithemailandpassword(email, password) .addoncompletelistener(this, new oncompletelistener<authresult>() {     @override     public void oncomplete(@nonnull task<authresult> task) {         logger.getlogger(loginactivity.class.getname()).log(level.all, "createuserwithemailandpassword:oncomplete:" + task.issuccessful());           if (task.issuccessful()) {             final arraylist<string> defaultroom = new arraylist<string>();             defaultroom.add("home");              // update user profile information             final firebaseuser user = task.getresult().getuser();             userprofilechangerequest profileupdates = new userprofilechangerequest.builder()                     .setdisplayname(string.valueof(displayusername))                     .setphotouri(uri.parse("https://example.com/jane-q-user/profile.jpg"))                     .build();             user.updateprofile(profileupdates).addoncompletelistener(new oncompletelistener<void>() {                 @override                 public void oncomplete(@nonnull task<void> task) {                     if (task.issuccessful()) {                         logger.getlogger(mainactivity.class.getname()).log(level.all, "user profile updated.");                         // construct chatuser                         userlist.user = new chatuser(user.getuid(),displayusername, edittextemail,true,defaultroom);                         // setup link users database                         firebasedatabase.getinstance().getreference("users").child(user.getuid()).setvalue(userlist.user);                         startactivity(new intent(mainactivity.this, userlist.class));                         finish();                     }                 }             });          }         else {              logger.getlogger(mainactivity.class.getname()).log(level.all, "createuserwithemailandpassword", task.getexception());             utils.showdialog(                     mainactivity.this,                     getstring(r.string.err_singup));           }      } }); } 

anyone idea on how fix this?


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -