Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

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?

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)

For understanding more clearly in Java, it is identical to below.

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.

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.