Back to project page AerisAndroidLibrary.
The source code is released under:
Apache License
If you think the Android project AerisAndroidLibrary listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.example.db; /* ww w . j a v a 2s. co m*/ import java.util.ArrayList; import java.util.List; public class MyPlacesSubject { public interface MyPlacesObserver { void notifyMyPlaceChanged(MyPlace place); } private static MyPlacesSubject inst; private List<MyPlacesObserver> observers; public static MyPlacesSubject getInstance() { synchronized (MyPlacesSubject.class) { if (inst == null) { inst = new MyPlacesSubject(); } return inst; } } public void notifyObservers(MyPlace place) { if (observers != null) { for (MyPlacesObserver ob : observers) { ob.notifyMyPlaceChanged(place); } } } public void registerObserver(MyPlacesObserver ob) { if (observers == null) { observers = new ArrayList<MyPlacesObserver>(); } observers.add(ob); } public void unregisterObserver(MyPlacesObserver ob) { if (observers == null) { return; } observers.remove(ob); } }