I am new to the android data binding and I was looking at the code which says, as bellow
@get:Bindable
var userIds: MutableList<Long> = mutableListOf()
private set(value) {
field = value
notifyPropertyChanged(BR.userIds)
}
so, what is the @get:Bindable does here. Is the @Bindable and @get:Bindable same?
@get:BindableIn simple words, this will put
@Bindableannotation on getter ofuserIds.
Below two are identical to each other. Or you can say two ways to put annotation on getter.
@get:Bindable
var userIds: MutableList<Long> = mutableListOf()
private set(value) {
field = value
notifyPropertyChanged(BR.userIds)
}
var userIds: MutableList<Long> = mutableListOf()
@Bindable get() = _title
set(value) {
field = value
notifyPropertyChanged(BR.userIds)
}
private ArrayList<Long> userIds = new ArrayList<>();
@Bindable
public ArrayList<Long> getUserIds() {
return userIds;
}
public void setUserIds(ArrayList<Long> userIds) {
this.userIds = userIds;
notifyPropertyChanged(BR.selected);
}
You can understand more about Annotations on official doc.
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