class SignUpActivity : AppCompatActivity() {
private lateinit var auth: FirebaseAuth
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_sign_up)
auth= Firebase.auth
initSignUpButton()
}
private fun initSignUpButton(){
val signUpButton= findViewById<AppCompatButton>(R.id.signUpButton)
signUpButton.setOnClickListener {
val email= getInputEmail()
val password= getInputPassword()
auth.createUserWithEmailAndPassword(email,password)
.addOnCompleteListener(this){ task ->
if(task.isSuccessful){
Toast.makeText(this, "completed to sign up.", Toast.LENGTH_SHORT).show()
startActivity(Intent(this, LoginActivity::class.java))
// finish()
}else {
Toast.makeText(this, "failed to sign up!", Toast.LENGTH_SHORT).show()
}
}
}
}
private fun getInputEmail(): String{
return findViewById<EditText>(R.id.inputEmailEditText).text.toString()
}
private fun getInputPassword(): String{
return findViewById<EditText>(R.id.inputPasswordEditText).text.toString()
}
}
After I push signup button, Toast message showed up in about 4minutes and user added too Not right after I pushed sign up button. I don't know why this is happened to me.
enter image description here - After push sign up button
(In 4mins..)
enter image description here - User added.
enter image description here -Layout
[Clicked signup button-> (4mins...) -> user added..] -result..
[Clicked signup button-> (1sec...) -> user added..] -I wish