Firebase SignUp Using Email and Password Authentication in android studio and kotlin - Joklinz-Tech

Latest

Home Of Tech news,jobs and android tutorials

Thursday, 8 February 2018

Firebase SignUp Using Email and Password Authentication in android studio and kotlin







class MainActivity : AppCompatActivity() {

    private var mauth = FirebaseAuth.getInstance()
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        setSupportActionBar(toolbar)
        requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT        val email = findViewById<View>(R.id.editT1) as EditText
        val password = findViewById<View>(R.id.editText4) as EditText
        val btn = findViewById<View>(R.id.button2) as Button
        val button = findViewById<View>(R.id.button4) as Button

        
              }
        button.setOnClickListener {            toast("Processing your form")
            mauth!!.createUserWithEmailAndPassword(email.text.toString().trim(),
             password.text.toString().trim())
                    .addOnCompleteListener(this) { task ->                        if (task.isSuccessful) {
                            toast("Registration Successful")
                            )

                        } else {
                            toast("Error User Already Registered / Invalid Email")
                        }
                    }        }




No comments:

Post a Comment