This has to be the most basic of question but after a full day of reading tutorials and the documentation here I can't seem to understand where to put these methods. None of the guides mention where this thing is placed it just mentions to use the annotation on a static method. What static method? Any static method at all regardless of class? What is a good practice? do I create a CustomBinding class to host all these static methods?
So long as I have the method has a BindingAdapter annotation and the first parameter is a View, it will work?
I assume if the first parameter is of type View I can place the binding attribute on any type of views and it will trigger the method? So if I have specific view say EditText, does this mean the method is only called when the attribute is found in an EditText view in the layout file?
After navigating through the internet I've finally found some info from one of the developers themselves. I wish they would have been more clear on the basics in the documentation.
Quote:
Binding adapters are annotated methods in any class that are used to do just this. Typically, you’d organize your adapters into [-a] classes based on the target View type.
This obviously means that at compile time all methods in any class with the annotation BindingAdapter will generate the BindingAdapter.
You place it in your model class.
Example:
XML:
Model:
}