Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Equivalent on Android to Key-Value Observing

Is there a technique on Android equivalent to Cocoa Touch's notification center and Key-Value Observing?

like image 584
DeadManSpirit Avatar asked Feb 11 '13 21:02

DeadManSpirit


People also ask

What is KVO key-value observation)?

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.

What is KVO controller?

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.

What is key-value observing Swift?

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.


2 Answers

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.

like image 120
Justin Jasmann Avatar answered Oct 13 '22 06:10

Justin Jasmann


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

like image 38
Tom Avatar answered Oct 13 '22 08:10

Tom