In the app, the Firebase login screen has multiple views, such as TextView, Button, and so on. Each button has click event to consume. In Android, we usually implement a click listener and then check which button is clicked with the help of a switch case. The following is the way we have written a case to consume a click for each respective button in Kotlin:
override fun onClick(v: View) { when (v.id) { R.id.emailCreateAccountButton -> createAccount(edtEmailId.text.toString(), edtPassword.text.toString()) R.id.emailSignInButton -> signIn(edtEmailId.text.toString(), edtPassword.text.toString()) R.id.signOutButton -> signOut() R.id.verifyEmailButton -> sendEmailVerification() }}
Typically, this replaces the switch case ...