Build 1.0_r1(from source)

android.database
Class Observable<T>

java.lang.Object
  extended by android.database.Observable<T>
Direct Known Subclasses:
ContentObservable, DataSetObservable

public abstract class Observable<T>
extends Object

Provides methods for (un)registering arbitrary observers in an ArrayList.


Field Summary
protected  ArrayList<T> mObservers
          The list of observers.
 
Constructor Summary
Observable()
           
 
Method Summary
 void registerObserver(T observer)
          Adds an observer to the list.
 void unregisterAll()
          Remove all registered observer
 void unregisterObserver(T observer)
          Removes a previously registered observer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mObservers

protected final ArrayList<T> mObservers
The list of observers. An observer can be in the list at most once and will never be null.

Constructor Detail

Observable

public Observable()
Method Detail

registerObserver

public void registerObserver(T observer)
Adds an observer to the list. The observer cannot be null and it must not already be registered.

Parameters:
observer - the observer to register
Throws:
IllegalArgumentException - the observer is null
IllegalStateException - the observer is already registered

unregisterObserver

public void unregisterObserver(T observer)
Removes a previously registered observer. The observer must not be null and it must already have been registered.

Parameters:
observer - the observer to unregister
Throws:
IllegalArgumentException - the observer is null
IllegalStateException - the observer is not yet registered

unregisterAll

public void unregisterAll()
Remove all registered observer


Build 1.0_r1(from source)

Please submit a feedback, bug or feature