Regarding findViewById

In new version of android studio, without using findViewById we cannot use any widget but the problem is that I cannot use findViewById method inside fragment class

@kodivine0 you can manually add kotlin synthetic if you don’t want to use findViewByid by adding
apply plugin: 'kotlin-android-extensions'
at the top of build.gradle (app)

incase you don’t want to use synthetic as it is deprecated. I suggest using ViewBinding or Databinding.
this requires adding a bit of code in every fragment or activity.

To use ViewBinding you can have a look at its setup instructions if you face any issues do let me know

apart from adding buildFeatures, what else do I need to add to achieve so?

This might help
For Activities
https://developer.android.com/topic/libraries/view-binding#activities

For Fragments
https://developer.android.com/topic/libraries/view-binding#fragments

the line containing ResultsProfileBinding is causing an error!

Can you mention the name of the xml file for the activity or fragment

activity_main.xml is the name of xml file

for activity_main.xml the generated binding class is MainActivityBinding,

ResultsProfileBinding was for the particular xml mentioned in the documentation i.e, (result_profile.xml)

generated binding class is different for each xml

Let me know if your doubt is resolved

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.