public abstract void addListener (InvalidationListener listener)

Adds an InvalidationListener which will be notified whenever the Observable becomes invalid. If the same listener is added more than once, then it will be notified more than once. That is, no check is made to ensure uniqueness.

Note that the same actual InvalidationListener instance may be safely registered for different Observables.

The Observable stores a strong reference to the listener which will prevent the listener from being garbage collected and may result in a memory leak. It is recommended to either unregister a listener by calling removeListener(InvalidationListener) after use or to use an instance of WeakInvalidationListener avoid this situation.

listener     The listener to register

NullPointerException     if the listener is null

See also: