Home > Net >  Having error while uploading user profile image to firebase, during authentication in android
Having error while uploading user profile image to firebase, during authentication in android

Time:02-28

screenshot

screenshots

i developed authentication with firebase it worked fine but i want to add an extra module to add user profie image. so I wrote 2 functions first for the user signup with email and password in firebase realtime database, and the second for uploading user profile image along with it... i just add pimage variable in user model class, but i am getting errors here in previous parameters of user model object and (uri.toString());

here is the code for creating user with email and password

private void register_doctor () {
            String dname = et_name.getText().toString().trim();
            String demail = et_email.getText().toString().trim();
            String dpass = et_pass.getText().toString().trim();
            String dcpass = et_cnf_pass.getText().toString().trim();
            String dcontact = et_contact.getText().toString().trim();
            String dcity = et_city.getText().toString().trim();
            String dage = et_age.getText().toString().trim();


            if (dname.isEmpty()) {
                et_name.setError("Full Name is Required");
                et_name.requestFocus();
                return;
            }
            if (demail.isEmpty()) {
                et_email.setError("Email is Required");
                et_email.requestFocus();
                return;
            }

            if (dpass.isEmpty()) {
                et_pass.setError("Password is Required");
                et_pass.requestFocus();
                return;
            }

            if (dpass.length() < 6) {
                et_pass.setError("Password Length Should be greater than 6 characters");
                et_pass.requestFocus();
                return;
            }

            if (dcpass.isEmpty()) {
                et_cnf_pass.setError("Password is Required");
                et_cnf_pass.requestFocus();
                return;
            }
            if (!dcpass.equals(dpass)) {
                et_cnf_pass.setError("Password Does not Matched!");
                et_cnf_pass.requestFocus();
                return;
            }

            if (dcontact.isEmpty()) {
                et_contact.setError("Contact is Required");
                et_contact.requestFocus();
                return;
            }

            if (dcity.isEmpty()) {
                et_city.setError("City is Required");
                et_city.requestFocus();
                return;
            }

            if (dage.isEmpty()) {
                et_age.setError("Age is Required");
                et_age.requestFocus();
                return;
            }

            progressBar.setVisibility(View.VISIBLE);

            mAuth.createUserWithEmailAndPassword(demail, dpass)
                    .addOnCompleteListener(new OnCompleteListener<AuthResult>() {
                        @Override
                        public void onComplete(@NonNull Task<AuthResult> task) {
                            if (task.isSuccessful()) {
                                User user = new User(dname, demail, dcontact, dcity, dage);           
  • Related