Android APIs
public class

BaseObservable

extends Object
implements Observable
java.lang.Object
   ↳ android.databinding.BaseObservable
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

A convenience class that implements Observable interface and provides notifyPropertyChanged(int) and notifyChange() methods.

Summary

Public Constructors
BaseObservable()
Public Methods
synchronized void addOnPropertyChangedCallback(Observable.OnPropertyChangedCallback callback)
Adds a callback to listen for changes to the Observable.
synchronized void notifyChange()
Notifies listeners that all properties of this instance have changed.
void notifyPropertyChanged(int fieldId)
Notifies listeners that a specific property has changed.
synchronized void removeOnPropertyChangedCallback(Observable.OnPropertyChangedCallback callback)
Removes a callback from those listening for changes.
[Expand]
Inherited Methods
From class java.lang.Object
From interface android.databinding.Observable

Public Constructors

public BaseObservable ()

Public Methods

public synchronized void addOnPropertyChangedCallback (Observable.OnPropertyChangedCallback callback)

Adds a callback to listen for changes to the Observable.

Parameters
callback The callback to start listening.

public synchronized void notifyChange ()

Notifies listeners that all properties of this instance have changed.

public void notifyPropertyChanged (int fieldId)

Notifies listeners that a specific property has changed. The getter for the property that changes should be marked with Bindable to generate a field in BR to be used as fieldId.

Parameters
fieldId The generated BR id for the Bindable field.

public synchronized void removeOnPropertyChangedCallback (Observable.OnPropertyChangedCallback callback)

Removes a callback from those listening for changes.

Parameters
callback The callback that should stop listening.