Kotlin Android start new Activity

后端 未结 17 2298
不知归路
不知归路 2020-12-07 23:33

I want to start another activity on Android but I get this error:

Please specify constructor invocation; classifier \'Page2\' does not have a companio

17条回答
  •  情话喂你
    2020-12-08 00:30

    Simply you can start an Activity in KOTLIN by using this simple method,

    val intent = Intent(this, SecondActivity::class.java)
    intent.putExtra("key", value)
    startActivity(intent)
    

提交回复
热议问题