Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IllegalStateException with No Bindings #14

Closed
dkpalmer opened this issue Sep 11, 2015 · 2 comments
Closed

IllegalStateException with No Bindings #14

dkpalmer opened this issue Sep 11, 2015 · 2 comments

Comments

@dkpalmer
Copy link

I realize this is a bit counter intuitive to the intent of the library, but I ran into the following exception when I had no bindings defined in my Item view model:

java.lang.IllegalStateException: Could not bind variable '3' in layout '<...>/item'
    at me.tatarka.bindingcollectionadapter.BindingCollectionAdapters.throwMissingVariable(BindingCollectionAdapters.java:276)

I ran into the exception while stubbing classes and layouts out to test the library. When I added a binding in my layout, everything worked fine. It seems like things should still work even if I decide not to have any bindings in my item layouts.

@evant
Copy link
Owner

evant commented Sep 11, 2015

The check is to ensure that the variable you are trying to bind to actually exsists in the layout. This way you immedatly know if you forgot to add it or use the wrong one. If you don't want a binding you can use ItemView.BINDING_VARIABLE_NONE.

There is currently a bug in the databinding library where if you declare a varibale but not use it in a binding it will return that it doesn't exist. This will be fixed in the next release.

@dkpalmer
Copy link
Author

Got it. Thanks for the quick response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants