We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
package com.example.pjwhatsapp;
import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity;
import android.app.Activity; import android.app.ProgressDialog; import android.os.Bundle; import android.view.View; import android.widget.Toast;
import com.example.pjwhatsapp.Models.Users; import com.example.pjwhatsapp.databinding.ActivitySignUpBinding; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.Task; import com.google.firebase.auth.AuthResult; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.database.FirebaseDatabase;
public class SignUpActivity extends AppCompatActivity {
ActivitySignUpBinding binding; private FirebaseAuth mAuth; FirebaseDatabase database; ProgressDialog progressDialog; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); binding = ActivitySignUpBinding.inflate(getLayoutInflater()); setContentView(binding.getRoot()); mAuth = FirebaseAuth.getInstance(); database = FirebaseDatabase.getInstance(); getSupportActionBar().hide(); ProgressDialog progressDialog = new ProgressDialog(SignUpActivity.this); progressDialog.setTitle("Creating Account"); progressDialog.setMessage("We are creating your account. "); binding.btnSignUp.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (!binding.txtUsername.getText().toString().isEmpty() && !binding.txtEmail.getText().toString().isEmpty() && !binding.txtPassword.getText().toString().isEmpty()) { progressDialog.show(); mAuth.createUserWithEmailAndPassword(binding.txtEmail.getText().toString(), binding.txtPassword.getText().toString()); .addOnCompleteListener( new OnCompleteListener<AuthResult>() { @Override public void onComplete(@NonNull Task<AuthResult> task) { if (task.isSuccessful()) { Users user = new Users(binding.txtUsername.getText().toString(),binding.txtEmail.getText().toString(),binding.txtPassword.getText().toString()); String id = task.getResult().getUser().getUid(); database.getReference().child("Users").child(id).setValue(user); Toast.makeText(SignUpActivity.this, "Sign Up Successful", Toast.LENGTH_SHORT).show(); } else { Toast.makeText(SignUpActivity.this, task.getException().toString(), Toast.LENGTH_SHORT).show(); } } }); } else { Toast.makeText(SignUpActivity.this, "", Toast.LENGTH_SHORT).show(); } } private void addOnCompleteListener(OnCompleteListener<AuthResult> sign_up_successful) { } }); }
}
The text was updated successfully, but these errors were encountered:
No branches or pull requests
package com.example.pjwhatsapp;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.app.Activity;
import android.app.ProgressDialog;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;
import com.example.pjwhatsapp.Models.Users;
import com.example.pjwhatsapp.databinding.ActivitySignUpBinding;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.FirebaseDatabase;
public class SignUpActivity extends AppCompatActivity {
}
The text was updated successfully, but these errors were encountered: