Hello, i have a problem with switching activitys in my app. I made a button that switches the activitys but everytime i press the button my app crashes. Android studio also gave me a few error codes. I have these in a screenshot and also the code for the activity switch. Would be great if someone could help.
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val MainActivity2 = findViewById<Button>(R.id.button)
MainActivity2.setOnClickListener {
val Intent = Intent(this,MainActivity2::class.java)
startActivity(Intent)
}