Skip to content
Advertisement

fragment binding (symbol “id” cannot be resolved)

I am trying to use the binding method in android studio to connect two fragments using onCreate and onViewCreated methods. so far i am getting id not resolved error. I have already connected the fragments on the xml graph. Bellow is the code of the settings java file.

JavaScript

Advertisement

Answer

Make sure to add this in build.gradle(app)

JavaScript

Then give sync project with gradle files. If this didnt work, try rebuild, invalidate cache/ restart.

Also view.findviewbyid not required if view binding is enabled. You can access button directly by something like this,

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement