Is there a technique on Android equivalent to Cocoa Touch's notification center and Key-Value Observing?
KVO, which stands for Key-Value Observing, is one of the techniques for observing the program state changes available in Objective-C and Swift. The concept is simple: when we have an object with some instance variables, KVO allows other objects to establish surveillance on changes for any of those instance variables.
Key-value observing (or KVO) can be an important factor in the cohesiveness of an application. It is a mode of communication between objects in applications designed in conformance with the Model-View-Controller design pattern.
Key-value observing is a Cocoa programming pattern you use to notify objects about changes to properties of other objects. It's useful for communicating changes between logically separated parts of your app—such as between models and views.
There's Property Change Listener.
Other than that, it's all pretty standard Java, so you'd be tying into EventListeners of one flavor or another.
An equivalent technique to NSNotificationCenter on android can be implemented via broadcasts and BroadcastReceivers. For more information you should read this: http://developer.android.com/guide/faq/commontasks.html#broadcastreceivers
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With