Stay organized with collections
Save and categorize content based on your preferences.
Bindable
public
abstract
@interface
Bindable
implements
Annotation
android.databinding.Bindable
|
The Bindable annotation should be applied to any getter accessor method of an
Observable
class. Bindable will generate a field in the BR class to identify
the field that has changed.
When applied to an accessor method, the Bindable annotation takes an optional
list of property names that it depends on. If there is a change notification of any of the
listed properties, this value will also be considered dirty and be refreshed. For example:
@Bindable
public void getFirstName() { return this.firstName; }
@Bindable
public void getLastName() { return this.lastName; }
@Bindable({"firstName", "lastName"}}
public void getName() { return this.firstName + ' ' + this.lastName; }
Whenever either firstName
or lastName
has a change notification, name
will also be considered dirty. This does not mean that
onPropertyChanged(Observable, int)
will be notified for
BR.name
, only that binding expressions containing name
will be dirtied and
refreshed.
Summary
Public methods
Annotations
Interfaces
Classes
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# Bindable\n\nSummary: [Methods](#pubmethods) \\| [Inherited Methods](#inhmethods) \\| [\\[Expand All\\]](#) \n\nBindable\n========\n\n\n`\npublic\n\n\nabstract\n@interface\nBindable\n`\n\n\n`\n\n\nimplements\n\n`[Annotation](http://developer.android.com/reference/java/lang/annotation/Annotation.html)`\n\n\n`\n\n|------------------------------|\n| android.databinding.Bindable |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nThe Bindable annotation should be applied to any getter accessor method of an\n[Observable](/reference/android/databinding/Observable) class. Bindable will generate a field in the BR class to identify\nthe field that has changed.\n\n\nWhen applied to an accessor method, the Bindable annotation takes an optional\nlist of property names that it depends on. If there is a change notification of any of the\nlisted properties, this value will also be considered dirty and be refreshed. For example:\n\n\u003cbr /\u003e\n\n @Bindable\n public void getFirstName() { return this.firstName; }\n\n @Bindable\n public void getLastName() { return this.lastName; }\n\n @Bindable({\"firstName\", \"lastName\"}}\n public void getName() { return this.firstName + ' ' + this.lastName; }\n \n\nWhenever either `firstName` or `lastName` has a change notification, `name`\nwill also be considered dirty. This does not mean that\n[onPropertyChanged(Observable, int)](/reference/android/databinding/Observable.OnPropertyChangedCallback#onPropertyChanged(android.databinding.Observable, int)) will be notified for\n`BR.name`, only that binding expressions containing `name` will be dirtied and\nrefreshed. \n**See also:**\n\n- [onPropertyChanged(Observable, int)](/reference/android/databinding/Observable.OnPropertyChangedCallback#onPropertyChanged(android.databinding.Observable, int))\n\nSummary\n-------\n\n| ### Public methods ||\n|-----------------------------------------------------------------------------|------------------------------------------------------------------|\n| ` `[String[]](http://developer.android.com/reference/java/lang/String.html) | ` `[value](/reference/android/databinding/Bindable#value())`() ` |\n\n| ### Inherited methods |\n|-----------------------|---|\n| From interface ` `[java.lang.annotation.Annotation](http://developer.android.com/reference/java/lang/annotation/Annotation.html)` ` |-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------| | ` abstract `[Class](http://developer.android.com/reference/java/lang/Class.html)`\u003c? extends `[Annotation](http://developer.android.com/reference/java/lang/annotation/Annotation.html)`\u003e` | ` annotationType() ` | | ` abstract boolean` | ` equals(`[Object](http://developer.android.com/reference/java/lang/Object.html)` arg0) ` | | ` abstract int` | ` hashCode() ` | | ` abstract `[String](http://developer.android.com/reference/java/lang/String.html) | ` toString() ` | ||\n\nPublic methods\n--------------\n\n### value\n\n```\nString[] value ()\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|--------------------------------------------------------------------------|--------|\n| [String[]](http://developer.android.com/reference/java/lang/String.html) | \u003cbr /\u003e |\n\n-\n\n Annotations\n -----------\n\n - [Bindable](/reference/android/databinding/Bindable)\n - [BindingAdapter](/reference/android/databinding/BindingAdapter)\n - [BindingConversion](/reference/android/databinding/BindingConversion)\n - [BindingMethod](/reference/android/databinding/BindingMethod)\n - [BindingMethods](/reference/android/databinding/BindingMethods)\n - [InverseBindingAdapter](/reference/android/databinding/InverseBindingAdapter)\n - [InverseBindingMethod](/reference/android/databinding/InverseBindingMethod)\n - [InverseBindingMethods](/reference/android/databinding/InverseBindingMethods)\n - [InverseMethod](/reference/android/databinding/InverseMethod)\n-\n\n Interfaces\n ----------\n\n - [DataBindingComponent](/reference/android/databinding/DataBindingComponent)\n - [InverseBindingListener](/reference/android/databinding/InverseBindingListener)\n - [Observable](/reference/android/databinding/Observable)\n - [ObservableList](/reference/android/databinding/ObservableList)\n - [ObservableMap](/reference/android/databinding/ObservableMap)\n-\n\n Classes\n -------\n\n - [BaseObservable](/reference/android/databinding/BaseObservable)\n - [CallbackRegistry](/reference/android/databinding/CallbackRegistry)\n - [CallbackRegistry.NotifierCallback](/reference/android/databinding/CallbackRegistry.NotifierCallback)\n - [DataBindingUtil](/reference/android/databinding/DataBindingUtil)\n - [ListChangeRegistry](/reference/android/databinding/ListChangeRegistry)\n - [MapChangeRegistry](/reference/android/databinding/MapChangeRegistry)\n - [MergedDataBinderMapper](/reference/android/databinding/MergedDataBinderMapper)\n - [Observable.OnPropertyChangedCallback](/reference/android/databinding/Observable.OnPropertyChangedCallback)\n - [ObservableArrayList](/reference/android/databinding/ObservableArrayList)\n - [ObservableArrayMap](/reference/android/databinding/ObservableArrayMap)\n - [ObservableBoolean](/reference/android/databinding/ObservableBoolean)\n - [ObservableByte](/reference/android/databinding/ObservableByte)\n - [ObservableChar](/reference/android/databinding/ObservableChar)\n - [ObservableDouble](/reference/android/databinding/ObservableDouble)\n - [ObservableField](/reference/android/databinding/ObservableField)\n - [ObservableFloat](/reference/android/databinding/ObservableFloat)\n - [ObservableInt](/reference/android/databinding/ObservableInt)\n - [ObservableList.OnListChangedCallback](/reference/android/databinding/ObservableList.OnListChangedCallback)\n - [ObservableLong](/reference/android/databinding/ObservableLong)\n - [ObservableMap.OnMapChangedCallback](/reference/android/databinding/ObservableMap.OnMapChangedCallback)\n - [ObservableParcelable](/reference/android/databinding/ObservableParcelable)\n - [ObservableShort](/reference/android/databinding/ObservableShort)\n - [OnRebindCallback](/reference/android/databinding/OnRebindCallback)\n - [PropertyChangeRegistry](/reference/android/databinding/PropertyChangeRegistry)\n - [ViewDataBinding](/reference/android/databinding/ViewDataBinding)\n - [ViewStubProxy](/reference/android/databinding/ViewStubProxy)"]]