Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Any downsides to implementing the Observer-Pattern inside a service?

 
James Elsey
Ranch Hand
Posts: 228
Android IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my app I want to "observe" an object if a button is pressed.

What I've done is create two buttons, "start" and "stop", these hook into the starting/stopping of a Service.

Inside that service, would it be a good place to implement an observer? ie when the service is started it will start observing another object, when it stops it will stop observing.

Is this a good design? Also, I can't find any specific examples/posts related to integrating the observer pattern and the service class, I can find separate tutorials but nothing combined.

Ankit, you're normally good for advice, any thoughts?
 
bacon. tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!