Kotlin: open new Activity inside of a Fragment

后端 未结 13 2130
醉话见心
醉话见心 2020-12-05 16:32

How can I open a new Activity inside of a fragment when using a button?

I tried this

override fun onViewCreated(view: View, savedInstanceState: Bundle?         


        
相关标签:
13条回答
  • 2020-12-05 17:29

    Put this

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

    inside the onCreate method of the Activity where the fragment is loaded

    0 讨论(0)
提交回复
热议问题