Intent gives error


#1

I’m trying to make a simple app, in this app there is only one button and when its clicked it will switch to another new activity

first activity code:

button.setOnClickListener { var intent = intent(this,second::class.java) startActivity(intent) }
intent becomes red with this error showing: “expression intent of type intent cannot be invoked as a function. the function invoke is not found”

what is the problem?


#2

solved this error, all i had to do is add this line: import android.content.Intent