I am trying to use a button to go to from a sign in page to a register page but for some reason it isn't working. From my understanding this process should be relatively simple but for some reason the action doesn't function as hoped.
I've tried using intent as I have for other pages but it just crashes the app (see Example 1). I do have another function on the same page using intent, is this an issue.
Example 1
val goToRegisterButton = findViewById<Button>(R.id.goToRegisterButton)
goToRegisterButton.setOnClickListener {
Toast.makeText(this, "Button Click!", Toast.LENGTH_SHORT).show()
val regIntent = Intent(this, RegisterActivity::class.java)
startActivity(regIntent)
}
I then tried calling a function which would do thintent side of things but again no luck (See Example 2).
Example 2
val goToRegisterButton = findViewById<Button>(R.id.goToRegisterButton)
goToRegisterButton.setOnClickListener {
Toast.makeText(this, "Button Click!", Toast.LENGTH_SHORT).show()
goRegisterActivity()
}
private fun goRegisterActivity() {
Log.i(TAG, "goRegisterActivity")
val regIntent = Intent(this, RegisterActivity::class.java)
startActivity(regIntent)
}
Edit: I was asked to add the stack trace, I think this is it. stack trace of issue