How to go from one fragment to another fragment in kotlin?

Published

I have a button in fragment A and when I click on fragment A, I want it to be redirected to fragment B. How to achieve this in kotlin? Right now I am using this code but app crash.

btntest.setOnClickListener {
            var intent = Intent(view.context, FragmentB::class.java)
            startActivity(intent)
        }

Source: Android Questions

Published
Categorized as android, android-fragments, fragment, kotlin

Answers

Leave a Reply

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq