Is communication between two fragments through an activity can be called as an Observer Pattern in android? -


i wanted clarify 1 thing related observer pattern in java.

observer pattern used when there one-to-many relationship between objects, such if 1 object modified, dependent objects notified automatically. observer pattern falls under behavioural pattern category.

this definition of observer pattern got.

http://www.tutorialspoint.com/design_pattern/observer_pattern.htm

the link suggests implementation.

my query related observer pattern is, have concept of event bubbling technique (or listener technique) use when want communicate data fragment fragment b, both hosted same activity c.

simple question - can call technique similar observer pattern ?

if interviewer asks me, cite example of observer pattern, can quote example. assumption yes, technique observer pattern, however, need confirmed opinion.

the definition posted mentions one-to-many relationship between caller , callee, true.

but considering activity , fragments, they're one-to-one relation. still valid when activity acts middle-man between 1 or more fragments.

rather observer pattern, pattern used in activity , fragment communication callback pattern, target instance implements interface caller can invoke.


Comments

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -