Most visited

Recently visited

BaseObservable

public class BaseObservable
extends Object implements Observable

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


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

Summary

Public constructors

BaseObservable()

Public methods

void addOnPropertyChangedCallback(Observable.OnPropertyChangedCallback callback)

Adds a callback to listen for changes to the Observable.

void notifyChange()

Notifies listeners that all properties of this instance have changed.

void notifyPropertyChanged(int fieldId)

Notifies listeners that a specific property has changed.

void removeOnPropertyChangedCallback(Observable.OnPropertyChangedCallback callback)

Removes a callback from those listening for changes.

Inherited methods

From class java.lang.Object
From interface android.databinding.Observable

Public constructors

BaseObservable

BaseObservable ()

Public methods

addOnPropertyChangedCallback

void addOnPropertyChangedCallback (Observable.OnPropertyChangedCallback callback)

Adds a callback to listen for changes to the Observable.

Parameters
callback Observable.OnPropertyChangedCallback: The callback to start listening.

notifyChange

void notifyChange ()

Notifies listeners that all properties of this instance have changed.

notifyPropertyChanged

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 int: The generated BR id for the Bindable field.

removeOnPropertyChangedCallback

void removeOnPropertyChangedCallback (Observable.OnPropertyChangedCallback callback)

Removes a callback from those listening for changes.

Parameters
callback Observable.OnPropertyChangedCallback: The callback that should stop listening.

Hooray!