小编kam*_*ilp的帖子

Kotlin Intent语法错误

我试图Intent在Android Studio的Kotlin中设置以启动另一个Activity.kt

val i : Intent = Intent(this, MainActivity::class.java)
Run Code Online (Sandbox Code Playgroud)

Android Studio向我显示了一个错误,并且无法编译:

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
Run Code Online (Sandbox Code Playgroud)

我认为语法是正确的,那怎么了?

android android-intent kotlin

0
推荐指数
1
解决办法
2430
查看次数

标签 统计

android ×1

android-intent ×1

kotlin ×1