Skip to content

Most visited

Recently visited

navigation

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.

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a one-minute survey?
Help us improve Android tools and documentation.