Home > Software design >  How can I move from one fragment to another fragment on button click? (kotlin)
How can I move from one fragment to another fragment on button click? (kotlin)

Time:03-31

I’m trying to move from one fragment to another fragment on button click and I have watched tutorials on YouTube using ViewBinding to perform this action. But each time I try, it just doesn’t seem to work. I have added the “build features{ ViewBinding true “ in my Gradle (module:app) file and each time I run my app, my app crashes with the error “unknown host: ‘dl.google.com’”

PS: findViewById doesn’t work in fragments

I have spent weeks trying to figure this out. Can someone pls help me out?

Thanks in Advance

CodePudding user response:

Moving from one fragment to another can be easily achieved using Navigation component. I would suggest taking a look at this link as a starting point:

https://developer.android.com/guide/navigation/navigation-getting-started

  • Related