Note: make sure the activity ur sending the data is the activity u will receive it else you will get errors.thanks
First activity
i.putExtra("id",mauth.currentUser!!.uid) i.putExtra("email",mauth.currentUser!!.email)
For a better Example
btn.setOnClickListener { toast("Logging In") mauth!!.signInWithEmailAndPassword(email.text.toString().trim(),
password.text.toString().trim()) .addOnCompleteListener(this){ task-> if (task.isSuccessful){ toast("Login successful") val i = Intent(this, Home::class.java) i.putExtra("id",mauth.currentUser!!.uid) i.putExtra("email",mauth.currentUser!!.email) i.putExtra("emailchecker",email.text.toString().trim()) startActivity(i) } else { toast("Invalid Credentials Or User Not Registered") } }}
Second activity
val intentid=intent.extras.getString("id") val intentemail=intent.extras.getString("email")
No comments:
Post a Comment