Skip to content

Instantly share code, notes, and snippets.

@surajme
Last active February 25, 2020 12:34
Show Gist options
  • Save surajme/901454fb23a41c84b88e8ee41d47676e to your computer and use it in GitHub Desktop.
Save surajme/901454fb23a41c84b88e8ee41d47676e to your computer and use it in GitHub Desktop.
val nameET = findViewById<EditText>(R.id.nameEt)
val phoneEt = findViewById<EditText>(R.id.phoneEt)
val saveBtn = findViewById<Button>(R.id.saveBtn)
//HANDLE BUTTON CLICK
saveBtn.setOnClickListener {
//GET TEXT FROM EDITTEXT
val name = nameET.text.toString()
val phone = phoneEt.text.toString()
//INTENT TO START NEW ACTIVITY
val intent = Intent (this, Main2Activity:: class.java)
intent.putExtra("Name", name)
intent.putExtra("Phone", phone)
startActivity(intent)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment