小编Jus*_*Guy的帖子

Kotlin:在片段中打开新的Activity

使用按钮时,如何在片段内打开新的活动?

我试过了

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
    super.onViewCreated(view, savedInstanceState)

    LogOut_btn.setOnClickListener {
        //FirebaseAuth.getInstance().signOut()
         val intent = Intent (this, Main::class.java)
        startActivity(intent)



    }



}
Run Code Online (Sandbox Code Playgroud)

val intent =意图似乎在片段中不起作用。

知道如何在片段中启动新活动吗?

感谢收到的每一个答复,也感谢您的帮助!

android android-fragments kotlin

3
推荐指数
2
解决办法
7320
查看次数

标签 统计

android ×1

android-fragments ×1

kotlin ×1