Can I use setOnClickListener in MVVM pattern? Or is it better to just use xml's onClick?
CodePudding user response:
The setOnClickListener function can be used anywhere in kotlin class like activity, fragment, or adapter regardless of the design pattern. And it's the better approach than using onClick on your XML files
CodePudding user response:
Yes, of course you can user setOnClickListener, personally I don't like to use xml onClick