Reputation: 1
I read similar questions and tried to figure out how to use the code because I'm new in kotlin. I always get an error and the info that I received is null always. I tried this code.
val intent:Intent = Intent(this, RecibirDatos::class.java)
intent.putExtra("nombre", binding.ptNombre.text)
startActivity(intent)
And in the other activity:
val extras = intent.extras
if (extras != null) { val value: String? = extras.getString("nombre")}
Upvotes: 0
Views: 68
Reputation: 76
Can you try this in the second line while passing data;
intent.putExtra("nombre", binding.ptNombre.text.toString())
Upvotes: 1