Android Data Binding: 2-way Your Way
George Mount

For custom views that are designed to be used with data binding, it would be nice to be able to annotate getter and setter methods on the view explicitly instead of having to annotate a class, give reference to the view class, and overriding the method name in case the attribute doesn’t match the getter/setter method. So for example:

public class MyCustomView extends View {
// .. constructors ..
public static final String SOME_PROPERTY = "someProperty";

private String someAttribute = "";

@InverseBindingMethod(attribute = SOME_PROPERTY)
public String getSomeAttribute() {
return someAttribute;

@BindingMethod(attribute = SOME_PROPERTY)
public void setSomeAttribute(final String someAttribute) {
this.someAttribute = someAttribute;
One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.