Kotlin Intent syntax error

kamilp

Im trying to set Intent in Kotlin in Android Studio to launch another Activity.kt:

val i : Intent = Intent(this, MainActivity::class.java)

Android Studio shows me an error, and it doesnt compile:

Error:(23, 26) None of the following functions can be called with the arguments supplied: 
public constructor Intent(p0: Context!, p1: Class<*>!) defined in android.content.Intent 
public constructor Intent(p0: String!, p1: Uri!) defined in android.content.Intent

I think syntax is correct, so what is wrong?

kamilp

val i = Intent(this@MainActivity, Activity::class.java)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related