notifyObservers() will only notify observers if hasChanged() returns true.
Ie. When a change is detected, you need to call setChanged() first before
calling notifyObservers.

https://docs.oracle.com/javase/7/docs/api/java/util/Observable.html#notifyObservers(java.lang.Object)

Steve

On Tue, Aug 23, 2016 at 11:53 AM, Akinniranye James <[email protected]>
wrote:

> The observer does not receive any event
>
> On Tuesday, August 23, 2016 at 7:52:50 PM UTC+1, Akinniranye James wrote:
>>
>> Observer observer = (Observable o, Object arg) -> {
>>        System.err.println("Got " + arg);
>>     };
>>     observable.addObserver(observer);
>>
>>     button.addActionListener(l -> {
>>       Display.getInstance().callSerially(() -> {
>>           observable.notifyObservers(new Date());
>>       });
>>     });
>>
> --
> You received this message because you are subscribed to the Google Groups
> "CodenameOne Discussions" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> Visit this group at https://groups.google.com/
> group/codenameone-discussions.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/codenameone-discussions/26fbcc57-1687-4e9f-ac53-
> 6f21db8384f1%40googlegroups.com
> <https://groups.google.com/d/msgid/codenameone-discussions/26fbcc57-1687-4e9f-ac53-6f21db8384f1%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Steve Hannah
Software Developer
Codename One
http://www.codenameone.com

-- 
You received this message because you are subscribed to the Google Groups 
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/codenameone-discussions/CAGOYrKUCwEkOQgV-3kcpk-DfVrJN%2BzW0_oNxyRE3-kEFhHBF4w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to