Kotlin Android start new Activity

后端 未结 17 2277
不知归路
不知归路 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:32

    From activity to activity

    val intent = Intent(this, YourActivity::class.java)
    startActivity(intent)
    

    From fragment to activity

    val intent = Intent(activity, YourActivity::class.java)
    startActivity(intent)
    

提交回复
热议问题