"Android Studio" shows error message "Type parameter T has incompatible upper bounds: ViewDataBinding and ActivityChecklistsBinding.
ActivityChecklistsBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_checklists);
Before update the ADK it works fine. Is there any ideas what wrong?
Generated data binding code automatically checks for null values and avoid null pointer exceptions. For example, in the expression @{user.name} , if user is null, user.name is assigned its default value of null . If you reference user. age , where age is of type int , then data binding uses the default value of 0 .
I had the same problem. I tried a couple of things, Clean and Rebuild project.
But, It worked after I choose File -> Invalidate Caches / Restart
The binding activity is automatically generated and takes the name from the layout file, not the activity class.
So if you have an activity named BeautifulActivity
and the corresponding layout named sweet_layout.xml
, then the generated name will be SweetLayoutBinding
and not BeautifulActivityBinding
.
Don't make my same mistake by confusing between MainActivity
and activity_main.xml
😉
Source Android Developers
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With